objective-c - 我需要释放 UITouch 对象吗?

标签 objective-c ios xcode memory-management

我有这样的方法:

-(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/initcopy 触摸,因此它被认为是自动释放的。

CGPoint 不是对象或引用,因此永远不应释放或自动释放。

关于objective-c - 我需要释放 UITouch 对象吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8548006/

相关文章:

ios - UICollectionView 委托(delegate)中的搜索栏 subview

ios - 我如何使用 Tapku Library 在特定日期放置 Day Event?

C++ 语法,打印帮助

ios - 扩展委托(delegate)中的调用方法

ios - 如何找到时间是在iOS中我的自定义时间之前一小时内

objective-c - 在 cocoa 状态应用程序中显示图像

iphone - 更改 iOS 标识符名称会导致核心数据错误?

ios - 当 userInteractionEnabled = YES 时,如何将触摸事件传递给 superview?

ios - 将 UIImageView 置于 UIScrollView 中居中

javascript - UIWebview 不会通过基本身份验证加载动态加载的资源(通过 jQuery Mobile)