久久久久久久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 創建圖像)
主站蜘蛛池模板: 久久精品国产一区老色匹 | www久久| h片在线免费看 | 成人免费在线观看 | 成人免费一区二区三区视频网站 | 欧美在线观看一区 | av在线播放国产 | av中文字幕在线播放 | 成人三区 | 国产视频三区 | 久久小视频| 欧美精品在线一区二区三区 | 一区二区视屏 | 中文字幕在线剧情 | 日韩视频一区二区在线 | av网站观看 | 欧美中文字幕在线 | 91精品国产91久久久久久最新 | 国产精品视频区 | 亚洲综合视频 | 亚洲协和影视 | 亚洲成人一区 | 毛片一级电影 | 日韩中文电影 | 欧美全黄 | 亚洲精品中文字幕在线观看 | 日韩中文字幕免费 | 日本精a在线观看 | 青青久久久 | 一区二区在线免费观看 | 精品国偷自产在线 | 亚洲国产精品人人爽夜夜爽 | 99久久精品国产一区二区三区 | 天天精品在线 | 91视频精选 | 亚洲精品国产电影 | 91色综合 | 国产亚洲网站 | 狠狠色网| 国产精品久久久99 | 国产乱码精品一区二区三区中文 |