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

    }

}

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章