将滑动事件提供给其他控件
我在 UIView 之上有一个 UITextView。 它们位于 PageScrollView 中。 用户可以在 UITextView 之外的任意位置滑动并轻拂下一页(视图)。 我希望用户在 UITextView 上滑动并轻拂下一个视图。
当文本太多时,UITextView 会垂直滚动,用户可以滑动文本并查看其余文本。 查看水平分页滚动。 我需要 UITextView 将其水平滑动给 UIView。 我怎样才能做到这一点?
I have a UITextView on top of a UIView. They are in a PageScrollView. The user can swipe anyhere outside of the UITextView and flick over the next page (view). I'd like the user to swipe on the UITextView and flick over the next view as well.
The UITextView scrolls vertically when there is to much text, which the user can swipe and see the rest. View paging scrolls horizontally. I need the UITextView to give its horizontal swipe to the UIView. How can I do that?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
如果您子类化
UITextView
并覆盖它的每个触摸事件:with this:
这将允许通过
处理所有触摸>UITextView
及其父视图。 由于您的UITextView
仅垂直滚动,而UIScrollView
仅水平滚动,因此效果很好。If you subclass
UITextView
and override each of it's touch events:with this:
This will allow handling of all touches by both the
UITextView
and its parent view. Since yourUITextView
scrolls exclusively vertically and yourUIScrollView
scrolls exclusively horizontally, this will work out fine.