久久久久久久av_日韩在线中文_看一级毛片视频_日本精品二区_成人深夜福利视频_武道仙尊动漫在线观看

以編程方式設置 contentOffset 觸發 scrollViewDidScrol

Setting contentOffset programmatically triggers scrollViewDidScroll(以編程方式設置 contentOffset 觸發 scrollViewDidScroll)
本文介紹了以編程方式設置 contentOffset 觸發 scrollViewDidScroll的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

問題描述

我在一個頁面上有幾個 UIScrollView.您可以單獨滾動它們或將它們鎖定在一起并將它們作為一個滾動.當它們被鎖定時會出現問題.

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 locked.

我使用 UIScrollViewDelegatescrollViewDidScroll: 來跟蹤運動.我查詢 UIScrollViewcontentOffset 已更改,然后通過將其 contentOffset 屬性設置為匹配來反映更改到其他滾動視圖.

I use UIScrollViewDelegate and scrollViewDidScroll: to track movement. I query the contentOffset of the UIScrollView which changed and then reflect change to other scroll views by setting their contentOffset property to match.

太好了....除了我注意到很多額外的電話.以編程方式更改滾動視圖的 contentOffset 會觸發委托方法 scrollViewDidScroll: 被調用.我嘗試使用 setContentOffset:animated: 代替,但我仍然在委托上獲得觸發器.

Great.... except I noticed a lot of extra calls. Programmatically changing the contentOffset of my scroll views triggers the delegate method scrollViewDidScroll: to be called. I've tried using setContentOffset:animated: instead, but I'm still getting the trigger on the delegate.

如何以編程方式修改我的 contentOffsets 以不觸發 scrollViewDidScroll:?

How can I modify my contentOffsets programmatically to not trigger scrollViewDidScroll:?

實施說明....每個 UIScrollView 都是自定義 UIView 的一部分,它使用委托模式回調處理協調各種 contentOffset 的呈現 UIViewController 子類 值.

Implementation notes.... Each UIScrollView is part of a custom UIView which uses delegate pattern to call back to the presenting UIViewController subclass that handles coordinating the various contentOffset values.

推薦答案

可以在不觸發委托回調scrollViewDidScroll:的情況下改變UIScrollView的內容偏移量,通過設置 UIScrollView 的邊界并將原點設置為所需的內容偏移量.

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;

這篇關于以編程方式設置 contentOffset 觸發 scrollViewDidScroll的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!

【網站聲明】本站部分內容來源于互聯網,旨在幫助大家更快的解決問題,如果有圖片或者內容侵犯了您的權益,請聯系我們刪除處理,感謝您的支持!

相關文檔推薦

How to subclass UIScrollView and make the delegate property private(如何繼承 UIScrollView 并使委托屬性私有)
Swift - how to get last taken 3 photos from photo library?(Swift - 如何從照片庫中獲取最后拍攝的 3 張照片?)
Photos app-like gap between pages in UIScrollView with pagingEnabled(使用 pagingEnabled 的 UIScrollView 中頁面之間的照片應用程序式間隙)
why UIScrollView is leaving space from top in ios 6 and ios 7(為什么 UIScrollView 在 ios 6 和 ios 7 中從頂部留下空間)
UIScrollView pauses NSTimer while scrolling(UIScrollView 在滾動時暫停 NSTimer)
Limiting the scrollable area in UIScrollView(限制 UIScrollView 中的可滾動區域)
主站蜘蛛池模板: 国产精品久久久久久久久久久免费看 | 久久久人成影片一区二区三区 | 欧美一区视频 | 久久亚洲国产 | 欧美13videosex性极品 | 一区二区三区亚洲 | 亚洲三级av | 一区二区三区视频在线免费观看 | 亚洲精品68久久久一区 | 国产视频久久 | 免费在线观看91 | 成人免费视频观看视频 | 亚洲福利网| 欧美激情在线精品一区二区三区 | 波多野结衣av中文字幕 | 成人精品视频在线 | 在线观看国产精品一区二区 | 日韩综合一区 | 夜久久 | 国产清纯白嫩初高生视频在线观看 | 精国产品一区二区三区 | 色资源在线观看 | 日韩美女在线看免费观看 | 午夜在线影院 | 中文字幕丁香5月 | 草草视频在线免费观看 | 91精品国产综合久久久久久丝袜 | 国产亚洲精品久久久久动 | 日韩精品免费视频 | 亚洲精品乱码久久久久久9色 | 天天插日日操 | 91视频进入 | 日韩高清一区二区 | 亚洲精品欧美 | 国产成人精品在线 | 欧美一级毛片免费观看 | 日本在线精品视频 | 国产精品一区二区三区四区五区 | 久久久久久久久久久丰满 | 久久亚洲免费 | 99在线观看视频 |