Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

UINavigationController overlapping the ViewController content

In my App I'm using a visually customized NavigationController to handle the page flow.

By default the Navigationbar appears on top and the content of the viewcontroller just below it. However what I'd like to achieve is that the actual content of the viewcontroller starts at the top of the screen and not below the navigationbar.

So at the moment it looks like (the green is the navigationbar): https://www.dropbox.com/s/va19l9whgy43ox2/Schermafbeelding%202014-11-18%20om%2015.39.18.png?dl=0

And I want the green to be overlapping the viewController, I checked all the navigationbar bools but I can't find the right property.

Any help would be appreciated

like image 778
user986690 Avatar asked May 11 '26 17:05

user986690


1 Answers

You probably want to check the value of your view controller's edgesForExtendedLayout property, and that the extendedLayoutIncludesOpaqueBars property is set to true (because your navigation bar looks to be opaque). Assuming you're using Swift it can be achieved like so:

// This is the default value of edgesForExtendedLayout
controller.edgesForExtendedLayout = .All; 

// The default for this is false
controller.extendedLayoutIncludesOpaqueBars = true;

The comments on your question about automaticallyAdjustsScrollViewInsets in regards to UIScrollView are also worth looking into if you're using that class.

like image 119
A. R. Younce Avatar answered May 14 '26 08:05

A. R. Younce