【发布时间】:2013-03-08 15:26:21
【问题描述】:
出现错误
@protocol TapDetectingImageViewDelegate;
@interface TapDetectingImageView : UIImageView {
id <TapDetectingImageViewDelegate> tapDelegate;
@property (nonatomic, assign) id <TapDetectingImageViewDelegate> tapDelegate;
@synthesize tapDelegate;
什么都试过了
_weak id <TapDetectingImageViewDelegate> tapDelegate;
@property (weak) id <TapDetectingImageViewDelegate> tapDelegate;
甚至也试过了
_unsafe_unretained id <TapDetectingImageViewDelegate> tapDelegate;
@property (_unsafe_unretained) id <TapDetectingImageViewDelegate> tapDelegate;
甚至尝试删除实例变量定义,因为在使用 ARC 模式时,综合会处理它。
但仍然无法消除此错误。
如果有人可以帮我解决这个错误。
谢谢。
【问题讨论】:
-
这是
__weak,而不是_weak -
我改了,但还是报错
-
我不得不清理它然后再次分析它,现在错误消失了。非常感谢你。我为此快疯了。
-
这个版本你试过了吗:@property (weak) id
tapDelegate;除了消除 ivar 和 @synthesize?这是标准方式,应该可以工作(可能也应该在声明中添加非原子)。 -
不要继承 UIImageView 来做到这一点。使用 UIGestureRecognizer。组合优于继承...
标签: iphone objective-c automatic-ref-counting xcode4.5