2011-12-17 94 views
0

我有一個方法,像這樣:我是否需要釋放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,以防止任何泄漏?

謝謝!

+0

[內存管理規則](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

回答

2

號你永遠不alloc/initcopy觸摸因此它被認爲自動釋放。

CGPoint不是一個對象或參考所以不應該被釋放或自動釋放。

相關問題