Setting contentOffset programmatically triggers scrollViewDidScroll

前端 未结 6 1304
别跟我提以往
别跟我提以往 2020-12-04 09:02

I\'ve got a a few UIScrollView on a page. You can scroll them independently or lock them together and scroll them as one. The problem occurs when they are locke

6条回答
  •  时光说笑
    2020-12-04 09:51

    It is possible to change the content offset of a UIScrollView without triggering the delegate callback scrollViewDidScroll:, by setting the bounds of the UIScrollView with the origin set to the desired content offset.

    CGRect scrollBounds = scrollView.bounds;
    scrollBounds.origin = desiredContentOffset;
    scrollView.bounds = scrollBounds;
    

提交回复
热议问题