r4id4
r4id4

Reputation: 6077

Setting the Navigation Bar to cover the Status bar in Modal Segues

This could be a stupid question but i couldn't figure it out. When i create a Push Segue it automatically should give me this if has a nav controller enter image description here

while when i create a Modal Segue i need to set a navigationBar from the palette and looks like this enter image description here

How can i make a custom navBar dragged from the palette to look like the first one? I need this because i set the Status Bar text to white in order to be in contrast with the navigation bar color, but in this was the status bar is invisible, being white on the white background

Upvotes: 1

Views: 613

Answers (2)

Marcio Romero Patrnogic
Marcio Romero Patrnogic

Reputation: 1156

The problem is that you are creating your own title bar.. what you should do.. instead of presenting modally the destination view controller... present modally a navigationcontroller.. that has the destination view controller set as root view controller.

hope you can understand what tried to say =P!

GL HF

hope this helps

Upvotes: 1

Jbryson
Jbryson

Reputation: 2915

You could add a property to the offset and height constraints. Then in the viewWillAppear method, set the constraints value to be -20 and 64 respectively

-(void)viewWillAppear:(BOOL)animated{
    [super viewWillAppear];
    [self.myNavBarTopConstraint setConstant:-20];
    [self.myNavBarHeightConstraint setConstant:64];
}

Upvotes: 1

Related Questions