【发布时间】:2012-03-07 08:38:16
【问题描述】:
我在窗口上有三个视图。一个 UIView 包含 UIScrollView,而 UIScrollView 包含一个 UILabel。所有这些视图都是 320*460。 现在我想处理 UILabel 上的长按事件并将点击事件传递给 UIView。 我重写了标签的 touchesEnded: 以获得新闻发布时间。 如果时间足够短,我使用 [[self nextResponder] touchesBegan:touches withEvent:event] 来传递它。 但是,即使我重写了 UIScrollview 并将 [[self nextResponder] touchesBegan:touches withEvent:event] 添加到它, UIView 也无法接收 touchesBegan 事件。 而且,如果我为 UIScrollView 设置 userInteractionEnabled=NO,UIView 会得到touchedBegan,而UILabel 无法接收它。
如果需要,我如何先在 UILabel 中获取触摸事件并将其传递给 UIView。
谢谢。
【问题讨论】:
-
感谢您的所有帮助。通过在标签中实现委托方法并在 UIViewController 中实现它,我已经实现了我的目标。
标签: iphone uiscrollview touch-event