7

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.

Amir Foghel
  • 853
  • 1
  • 12
  • 28
  • Did you fix this issue? Also, dup - http://stackoverflow.com/questions/22115821/uinavigationitem-prompt-issue – elcuco Aug 06 '14 at 13:33

2 Answers2

3

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];
}
D Lindsey
  • 111
  • 6
0

I was running into the same issue, removing the prompt in viewWillDissapear before the next view is presented worked for me:

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

    [[self navigationItem] setPrompt: nil];
}
riocordero
  • 119
  • 1
  • 5
  • I can se this problem - and your solution does not work for me, as the prompt will resize only after the previous controller is displayed, and thus living that gap. Any ideas? – elcuco Aug 06 '14 at 13:49
  • This does not work for me either, prompt resizes after the previous controller is displayed. Still leaves the gap. – lostintranslation May 17 '16 at 18:30