我将如何为ARC重构此代码:
- (UIGestureRecognizer *)createTapRecognizerWithSelector:(SEL)selector {
return [[[UITapGestureRecognizer alloc] initWithTarget:self action:selector] autorelease];
}
感谢您的帮助
答案 0 :(得分:4)
删除autorelease语句并重命名方法:
- (UIGestureRecognizer *)newTapRecognizerWithSelector:(SEL)selector
{
return [[UITapGestureRecognizer alloc] initWithTarget:self action:selector];
}
答案 1 :(得分:2)
删除autorelease
。应该这样做
希望这会对你有所帮助。