2011-08-13 19 views
0

所以我有一个滚动视图,我想要的是,当我结束我的触摸(touchesEnded)在此滚动视图:(做某事),但它不检测我的touchesended我不知道为什么。我怎样才能解决这个问题,请.sorry,我的英语我是法国人:/检测touchesEnd在滚动视图

+0

如果您向我们展示,您是如何尝试的,我们可以说,可能是错的。 – vikingosegundo

回答

0

子类的UIScrollView这样,它应该工作: 在.h文件中:

@interface MyScrollView : UIScrollView { 
} 

@end 

在.m文件:

@implementation MyScrollView 

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

顺便说一句,这不是我自己的发明,在很多网站和教程中都看到过,也许你应该在提问前多研究一下。您可能不得不忽略if(self.dragging)子句,具体取决于您的需要。 – SideSwipe