Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Content in scroll view is shifted down with height value of navigation menu

I use view controller with embedded in navigation controller.

In this view I added scroll view and then content view inside scroll view

I added constrains for scroll view - zero for top, bottom, leading, and trailing. And the same for content view - zero for top, bottom, leading, and trailing. And I added width and height for content view the same as main view.

Inside content view I need to add different content (labels, text fields, buttons) - this will be settings screen with vertical scroll.

Now I see that content is always shifted down a bit (the same value as menu height)

How to make to located vertically on top?

And how to put all the content in the content view that should be vertically long and scrollable vertically?

enter image description here

enter image description here

enter image description here

like image 388
Bogdan Laukhin Avatar asked Dec 11 '22 17:12

Bogdan Laukhin


2 Answers

I think you forget to remove tick -> Adjust scrollview insects .

enter image description here

like image 178
Badal Shah Avatar answered Jan 05 '23 00:01

Badal Shah


Just add this line to the viewDidload method of your ViewController.

self.automaticallyAdjustsScrollViewInsets = NO;
like image 36
Kunal Kumar Avatar answered Jan 04 '23 23:01

Kunal Kumar