UIScrollView解决touchesBegan等方法不能触发的解方案

新建一个类继承自UIScrollView  并重写下面的方法

-(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];

    }

}

posted @ 2015-10-10 17:07  上官元空  阅读(571)  评论(0编辑  收藏  举报