【发布时间】:2015-03-05 08:49:31
【问题描述】:
我有一个带有 2 个子视图的 UIView,我们称之为视图 A:
- 一个基本的
UIView,称为B - 一个
UIScrollView,叫C
我在视图A中重写了以下方法:
- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event- (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event
当我触摸视图B、touchesBegan:withEvent: 和touchesEnded:withEvent: 时,会被调用,但如果我触摸UIScrollView(视图C),则不会调用。
我知道这是预期的行为,但我试图了解原因。我找不到任何明确的答案。有什么想法吗?
【问题讨论】:
-
视图 C 在布局方面是否在视图 B 之下?你会在被覆盖的方法中调用超级方法吗?
-
B 和 C 不重叠。是的,我称之为超级方法。
-
@TonyMkenu :我不想禁用 UIScrollView 上的用户交互
标签: ios objective-c uiview uiscrollview