iOS开发UIScrollView的touchesBegan和touchesEnd

touchesBegan跟touchedEnd]有提供oUIScrollViewDelegate

所以要自己建立一^承自UIScrollView的class

重@method

myScrollView.h

@interface myScrollView : UIScrollView 


@end 

myScrollView.m

-(void) touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event{ 


[super touchesBegan:touches withEvent:event]; 


if ( !self.dragging ) 


{ 


[[self nextResponder] touchesBegan:touches withEvent:event]; 


} 


} 


 


-(void) touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event{ 


[super touchesEnded:touches withEvent:event]; 


if ( !self.dragging ) 


{ 


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


} 


} 

相关推荐