View Inside scroll view shifts down

72 views Asked by At

I am using view inside a scroll view using autolayout , I have set the scrollview constraint as top,bottom,leading and trailing. View inside the scroll view is also set up with same constaint top,bottom,leading and trailing with scrollview. But the view shifts down at runtime.

I am attaching the screen shots.

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

enter image description here

1

There are 1 answers

0
Nicola Giancecchi On BEST ANSWER

Try to add in the viewDidLoad() method:

self.automaticallyAdjustsScrollViewInsets = NO

Take a look at this answer for a complete and detailed explanation about automaticallyAdjustsScrollViewInsets and other related UIScrollView flags: https://stackoverflow.com/a/19585104/1392452