2016-09-15 63 views
4

我只是更新我的xcode從7.3到8,並面對所有UISrollviews一些奇怪的行爲。雖然在設備子視圖內的滾動視圖測試是對齊屏幕的中心,但在故事板它安排得非常好。我沒有得到任何線索,這種意外的行爲。請幫助..XCODE 8 UIScrollView奇怪的行爲沒有自動佈局

+0

請提供更多關於你的信息已經這樣做的遠:http://stackoverflow.com/help/how問問 –

+0

使用Autolayout,那麼它會正常工作 –

+0

我面臨同樣的問題在Xcode8的滾動視圖沒有自動佈局 – shreeji

回答

0

你必須在滾動視圖添加一個子視圖與命名(scrollContainerVw),並設置以下引腳: enter image description here enter image description here 兩個滾動視圖和子視圖。

如果你想支持多屏請添加下面的視圖代碼做負載:

self.scrollVw.frame.size.width = self.view.frame.size.width 
    self.scrollVw.frame.size.height = self.view.frame.size.height 
    self.scrollContainerVw.frame.size.width = self.view.frame.size.width 
    self.scrollContainerVw.frame.size.height = self.view.frame.size.height