【发布时间】:2012-06-10 08:31:09
【问题描述】:
这里举一个例子,(使用 ARC)
UITapGestureRecognizer *tapGesture = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(onTap:)];
[subView1 addGestureRecognizer:tapGesture ];
[subView2 addGestureRecognizer:tapGesture];
问题来了:
subView1 不会响应 tapGesture ,但 subView2 会。
如果我们从 subview2 中删除 tapGesture,subView1 将起作用。
在内存管理方面内部发生了什么?为什么不设计使上面的代码工作?
【问题讨论】:
标签: ios ios5 memory-management automatic-ref-counting uigesturerecognizer