我有一个UiviewController,最重要的是,我放了一个UIImageView,然后是UISCrollView。

我可以很好地处理UISCrollView,但是我想对UiviewController进行某些触摸。

我只需要对持续5秒钟的UISCrollView进行触摸(此部分工作正常)。我想传递给UiviewController。

在uiscrollview上,我称之为:

- (void) touchesBegan: (NSSet *) touches withEvent: (UIEvent *) event
{
// some custom code to process a specific touch.

// all other touches
    [super touchesBegan: touches withEvent: event];
}

有没有办法将触摸从UISCrollView传递到底部的UiviewController,还是我必须将对UiviewController的引用传递到UISCROLLVIEW?

有帮助吗?

解决方案

解决了!

需要添加:

[self.nextResponder touchesEnded: touches withEvent:event]; 

到达最高控制器。

谢谢自己!

其他提示

Apple文档中的Touchesbegan描述告诉:

要将消息转发给下一个响应者,请将消息发送到Super(超类实现);请勿将消息直接发送给下一个响应者。例如,

[super touchesBegan:touches withEvent:event];

如果您不调用SUPER(一种常见的使用模式),则必须覆盖此方法,则还必须覆盖其他用于处理触摸事件的方法,即使仅作为存根(空)实现。

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top