iOS - UIScrollView sliding interception related

The main method used in a proxy

- (void)scrollViewDidScroll:(UIScrollView *)scrollView {
    NSLog(@"scrollViewDidScroll");
    CGFloat y = scrollView.contentOffset.y;
    CGFloat asd = kScreenHeight - scrollView.size.height - 20;
    if (y <= 0) {
        //下滑
    } else {
        //上滑

    }
}

It is noteworthy that, when the finger leaves the screen is still slow deceleration of UIScrollView slide, if you want to stop it immediately slide, only need to implement the following proxy method

// finger off immediately stop 
- ( void ) scrollViewWillBeginDecelerating: (the UIScrollView * ) the scrollView 
{ 
    [setContentOffset the scrollView: Animated scrollView.contentOffset: NO]; 
}

 

Guess you like

Origin www.cnblogs.com/qiyiyifan/p/11757159.html