Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Removing UINavigationItem prompt making black space on bottom of navigation bar

I have view controller in my storyboard with prompt text line but when I'm pushing a new view controller without prompt line in the navigation bar i get this (see picture) black space between the navigation bar and the view controller main view.

black area under the navigation bar

i already tried to remove the prompt using this:

    [self.navigationItem setPrompt:nil];

but i still having this problem.

like image 888
Amir Foghel Avatar asked Dec 31 '13 14:12

Amir Foghel


People also ask

Can we change navigation bar in iPhone?

Change the Bar StyleA user changes the navigation bar's style, or UIBarStyle , by tapping the “Style” button to the left of the main page. This button opens an action sheet where users can change the background's appearance to default, black-opaque, or black- translucent.

What is Scrolledgeappearance?

The appearance settings for the navigation bar when the edge of scrollable content aligns with the edge of the navigation bar. iOS 13.0+ iPadOS 13.0+ Mac Catalyst 13.1+ tvOS 13.0+


1 Answers

Here is a work-around for setPrompt. It doesn't animate, so it I'm calling it a work-around instead of a solution. Must be in viewDidAppear, not viewWillAppear.

-(void) viewDidAppear:(BOOL)animated {
    [super viewDidAppear:animated];

    // This is needed for apple bug with self.navigationItem.prompt
    [self.navigationController.navigationBar setNeedsUpdateConstraints];
}
like image 167
D Lindsey Avatar answered Sep 28 '22 05:09

D Lindsey