我是否需要释放UITouch对象?
问题描述:
我有一个方法,像这样:我是否需要释放UITouch对象?
-(void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event{
//Use to animate drag
UITouch *touch = [touches anyObject];
CGPoint currentLocation = [touch locationInView:self];
[self colorDragedOver:currentLocation];
[touch release];
}
我需要释放无论是UITouch或CGPoint,以防止任何泄漏?
谢谢!
答
号你永远不alloc/init
或copy
触摸因此它被认为自动释放。
CGPoint
不是一个对象或参考所以不应该被释放或自动释放。
[内存管理规则](http://developer.apple.com/library/mac/documentation/Cocoa/Conceptual/MemoryMgmt/Articles/mmRules.html#//apple_ref/doc/uid/20000994-SW1)简单而全面。 – outis 2011-12-17 22:13:36