2016-12-17 137 views
1

我正在使用autolayout在滾動視圖內使用視圖,我已將scrollview約束設置爲頂部,底部,前導和尾隨。滾動視圖內部的視圖也使用相同的頂部,底部,前後滾動視圖進行設置。但是視圖在運行時會下移。查看內部滾動視圖向下移動

我附上屏幕截圖。

In bluee color there is scroll view and in gray color it is uiview

enter image description here

回答

2

嘗試在viewDidLoad()添加方法:

self.automaticallyAdjustsScrollViewInsets = NO 

看看這個答案約automaticallyAdjustsScrollViewInsets和其他相關UIScrollView標誌的完整和詳細的解釋:https://stackoverflow.com/a/19585104/1392452