pbe*_*ery 5 iphone objective-c
我有一个包含UITextView(不可编辑)的UIScrollView.我不能让UIScrollView获取触摸事件,UITextView似乎得到它们并保留它们.知道如何让UIScrollView获取触摸事件吗?
我希望UITextView仍然可以垂直滚动(我的UIScrollView只能水平滚动).
在您的UITextView子类中,执行以下操作:
- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event {
[self.nextResponder touchesBegan:touches withEvent:event];
}
Run Code Online (Sandbox Code Playgroud)
如果你UITextView也想处理触摸,那么我相信你可以这样做:
- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event {
[self.nextResponder touchesBegan:touches withEvent:event];
[super touchesBegan:touches withEvent:event];
}
Run Code Online (Sandbox Code Playgroud)
但这可能会导致非常奇怪的行为。
| 归档时间: |
|
| 查看次数: |
5592 次 |
| 最近记录: |