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

彈回 UIViewController 后 UIScrollView 的原點發生變化

UIScrollView#39;s origin changes after popping back to the UIViewController(彈回 UIViewController 后 UIScrollView 的原點發生變化)
本文介紹了彈回 UIViewController 后 UIScrollView 的原點發生變化的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

問題描述

我有一個 UIViewController 子類作為情節提要中的場景,其中包含一個包含各種子視圖的 UIScrollView.其中一個子視圖是一個 UIButton ,它進入另一個場景 UIViewController 子類.當我從視圖返回時(將 UIViewController 從導航控制器堆棧中彈出),我發現滾動視圖的原點發生了某種變化,盡管 contentsizecontentoffset 看起來是正確的.

I have a UIViewController subclass as a scene in the storyboard that contains a UIScrollView containing various subviews. One of the subviews is a UIButton which segues into another scene UIViewController subclass. When I come back from the view (pop the UIViewController off the navigation controller stack), I find that the scroll view's origin has somehow changed, although the contentsize and contentoffset seem correct.

另外有趣的是,該應用程序有一個標簽欄,當我離開并返回該視圖時,滾動視圖被正確設置為偏移量為 (0, 0).

What's also interesting is that the app has a tab bar, and when I tab away and back to that view, the scroll view is set back correctly with offset at (0, 0).

這個過程基本上不涉及任何代碼,因為它幾乎都在情節提要中.由于我對使用情節提要相當陌生,因此我認為我做錯了,盡管我不知道是什么.關于那可能是什么的任何想法?也許是規模問題或限制?

There is basically no code involved in this process, as it's pretty much all in the storyboard. As I am fairly new to using the storyboard, I figure I'm doing something wrong, although I don't know what. Any ideas as to what that may be? Perhaps sizing issues or constraints?

推薦答案

其實我把那行代碼放在viewDidDisappear中,為了讓view重新出現時記住偏移量,我加了這個前一行

Actually, I put that line of code in viewDidDisappear, and so that it remembers the offset when the view reappears, I added this line before it

 self.contentOffset = self.scrollView.contentOffset;

還有

 - (void)viewDidLayoutSubviews { 
       self.scrollView.contentOffset = self.contentOffset; 
 }

這篇關于彈回 UIViewController 后 UIScrollView 的原點發生變化的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!

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

相關文檔推薦

iOS - Using storyboard and autolayout to center the UIScrollView(iOS - 使用故事板和自動布局使 UIScrollView 居中)
get index or tag value from imageview tap gesture(從 imageview 點擊手勢獲取索引或標簽值)
UIScrollView not scrolling regardless of large contentSize(無論內容大小如何,UIScrollView 都不會滾動)
Clean autorotation transitions in a paging UIScrollView(清除分頁 UIScrollView 中的自動旋轉轉換)
UIScrollView zooming with Auto Layout(UIScrollView 使用自動布局縮放)
How to create an image from a UIView / UIScrollView(如何從 UIView/UIScrollView 創建圖像)
主站蜘蛛池模板: 国产综合亚洲精品一区二 | 午夜激情小视频 | 日韩欧美视频在线 | 看片黄全部免费 | 国产一区在线播放 | 日韩理论在线 | 国产一级二级三级 | 69av在线播放 | 亚洲午夜一区 | 欧美视频在线一区 | 久久精品中文 | 日韩av免费在线 | 国产成人午夜精品 | 欧美日韩成人一区二区三区 | 免费黄色av | 亚洲第一色网 | 亚洲 欧美 激情 另类 校园 | 国产寡妇亲子伦一区二区三区四区 | 国产午夜精品视频 | 91青青| 亚洲天堂网在线观看 | 一区二区黄色 | 欧美999| 国产精品久久久久久久成人午夜 | 成人午夜又粗又硬又大 | 中国毛片视频 | 久久久三级| 国产黄在线 | 成年人网站在线免费观看 | 特级西西444www大胆免费看 | 欧美日韩久久久 | 色妞综合网 | 午夜在线视频观看 | 夜夜操av| 久久草视频| 蜜桃av一区二区三区 | 日日干夜夜干 | 成人一区二区三区 | 午夜激情福利 | 日韩精品大片 | 91tv国产成人福利 |