ban*_*isa 13

我是这样做的,因为有时使用委托对我来说不实用,就像我在UIViewController过渡中这样做:

[UIView animateWithDuration:0.3 animations:^{
    [scrollView setContentOffset:CGPointMake(0, -scrollView.contentInset.top) animated:NO];
} completion:^(BOOL finished) {
    // This is called when it's complete
}];
Run Code Online (Sandbox Code Playgroud)


Mar*_*uro 5

按以下方式为 UIScrollView实现UIScrollViewDelegate委托方法:

当您通过调用或 方法(使用animated:YES)scrollViewDidEndScrollingAnimation:启动滚动时,用于检测滚动动画何时结束。setContentOffset:animated:scrollRectToVisible:animated:

如果要监视由触摸手势启动的滚动视图运动,请使用scrollViewDidEndDecelerating:方法,该方法在滚动运动停止时调用。