2016-04-09 108 views
1

我不明白爲什麼我的滾動視圖沒有加載到座標上,我告訴它加載在。添加一個子視圖到UIScrollView

view.frame = CGRectMake(scrollView.bounds.width * CGFloat(i), 0, scrollView.bounds.width, scrollView.bounds.height) 

scrollView.addSubview(view) 

但是它不能完全接觸滾動型的頂部,我會期待它:我用下面的代碼加載子視圖

This is what the screen looks like when loaded for the first time

但是,當我開始與我的子視圖交互它最多拍攝,我想它是位置:

This is what the screen looks like when there has been interaction

回答

1

嘗試設置自動調整滾動查看輸入您的視圖控制器的屬性爲false viewDidLoad

self.automaticallyAdjustsScrollViewInsets = false 

該屬性的缺省值是「真」,這使得視圖控制器來調整響應於由所述狀態欄,導航欄所消耗的屏幕區域的滾動視圖的插圖,和工具欄或標籤欄。

相關問題