首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 移动开发 > 移动开发 >

解决UIScrollView缴获touch事件的一个极其简单有效的办法

2013-01-18 
解决UIScrollView截获touch事件的一个极其简单有效的办法当UIScrollView将touch事件截获时,我们可以要写个

解决UIScrollView截获touch事件的一个极其简单有效的办法
当UIScrollView将touch事件截获时,我们可以要写个UIScrollView的类别,把事件从UIScrollView传出去!

@implementation UIScrollView (UITouch)- (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];}@end

然后重写nextResponder的touch方法就可以了。


热点排行