2010-08-31 63 views

回答

1

讲究,如果任何视图添加到窗口捕获事件,不转发它,window对象永远不会收到它。 UIScrollView通常会这样做。在这种情况下,你还需要继承阻塞视图转发这样的事件,例如:

在一个UIScrollView子类

-(void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event { 
    if (!self.dragging) { 
     [self.nextResponder touchesEnded: touches withEvent:event]; 
    }  
    [super touchesEnded: touches withEvent: event]; 
} 
+0

UIScrollView的子类是指,请给交代.....我可以直接处理在appdelegate.m文件触摸事件的UIWindow – 2010-09-01 03:53:56

+0

子类的UIScrollView意味着创建一个从继承的UIScrollView像 @interface myScrollView类:UIScrollView的{} @ 结束 – VdesmedT 2010-09-01 08:04:53

3

查看Apple的UIResponder类文档。 UIWindow从UIResponder类下降,因此可以选择处理包含UIViews的所有UI事件,包括触摸事件。

+0

任何教程吗? – 2010-08-31 09:05:27

1

子类从一个UIWindow

你的窗口

然后实现: 的touchesBegan,touchesMoved,touchesEnd功能