UIScollView Touch事件

customScrollView.h

#import <UIKit/UIKit.h>

@interface customScrollView : UIScrollView

@end

customScrollView.m

//传递touch事件
- (void)touchesBegan:(NSSet*)touches withEvent:(UIEvent*)event
{
    if(!self.dragging)
        
    {
        [[self nextResponder]touchesBegan:touches withEvent:event];
    }
    
    [super touchesBegan:touches withEvent:event];
}

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



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

 

posted @ 2014-05-25 15:47  菜鸟程序猿  阅读(191)  评论(0编辑  收藏  举报