2010-08-14 82 views
1

我有一个UIViewController,顶上我把UIImageView,然后UIScrollView。iPhone:接触UIViewController

我可以在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?

回答

1

解决!

需要添加:

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

到最高控制器。

谢谢你自己!在苹果文档

0

的touchesBegan说明会告诉:

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

[super touchesBegan:touches withEvent:event]; 

如果你没有覆盖超调用这个方法(一种常见的使用模式),您还必须重写处理触摸事件,如果仅仅作为存根(空)实现的其他方法。

相关问题