【发布时间】:2011-02-10 11:42:07
【问题描述】:
我已将 scrollView.userInteractionEnabled 设置为 NO,以便 superview 捕获触摸事件。
在适当的时候,从我的一个自定义 view 类中调用
scrollView.userInteractionEnabled = YES;
[scrollView touchesBegan: touches withEvent: event];
or moved/ended similarly.
我可以看到我的 scrollView 正在通过我的调试输出获取触摸事件消息。
但我没有看到它滚动这怎么可能?
contentSize 足够大,scrollEnabled 为 YES。
(当我在启动时设置 scrollView.userInteractionEnabled = YES 时,scrollView 滚动正常)
例如,我的 UIScrollView 子类有
- (void) touchesBegan: (NSSet *) touches withEvent: (UIEvent *) event
{
SYSLOG(LOG_DEBUG, "MyScrollView touchesBegan");
[self setUserInteractionEnabled: YES];
[self setScrollEnabled: YES];
[super touchesBegan: touches withEvent: event];
}
- 编辑
在视图类或视图控制器类中重载 touchesBegan 可能会有所不同?
【问题讨论】:
标签: iphone touch scrollview