0

在我正在处理的当前项目中,在其中一个视图上,我有一个UIView和在它之上,它UIScrollView是从界面构建器构建的。

我已经实现了以下UIResponder实例方法:

- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event
- (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event

但是只有当触摸事件发生在未被覆盖的区域时,控件才会使用此方法UIScrollView

我怎样才能获得触摸事件UIScrollView呢?

4

1 回答 1

0

您可以创建 UIScrollView 的子类并覆盖:

- (BOOL)touchesShouldBegin:(NSSet *)touches withEvent:(UIEvent *)event inContentView:(UIView *)view

您必须小心不要干扰滚动手势等。

于 2011-12-23T01:40:11.063 回答