Detecting UIScrollView page change

前端 未结 10 2209
鱼传尺愫
鱼传尺愫 2020-12-07 17:11

Is there a way to detect or get a notification when user changes the page in a paging-enabled UIScrollView?

10条回答
  •  感动是毒
    2020-12-07 17:51

    In paging enabled scroll view you can use scrollViewDidEndDecelerating to know when the view is settled on a page (might be the same page).

    - (void)scrollViewDidEndDecelerating:(UIScrollView *)scrollView
    

    scrollViewDidScroll gets called on every movement. And in context of paging enabled view can be used to find when it is scrolled enough to move to next page (if dragging is stopped at that point).

提交回复
热议问题