There are several similar questions which got no answers but were describe vaguely. I have reduced the problem into a very thin application, and added detailed screenshots. I would highly appreciate a solution for this!
The only involved code is one line added to viewDidLoad of the root VC. The purpose of this line is to make the navigation controller opaque:
- (void)viewDidLoad
{
[super viewDidLoad];
self.navigationController.navigationBar.translucent = NO;
}
A critical information for this question is that 'Title1' has a prompt in its navigation item, while 'Title2' has not prompt.
I have a storyboard with one navigation controller, one root VC called "Title1", with a segue button which takes to a second VC called "Title2"
When pressing the button here:
I'm getting this strange screen:
When pressing back (Title1), it gets worse (i.e.: the original label of Title1 was pushed up and now not being seen anymore!!!):
Anyone please??
Late answer but I stumbled across this problem today and found your question and it doesn't have an accepted answer yet.
I got this error while going from a prompted viewController to a non prompted viewController in storyboard.
I got that black bar just like you.
And to fix:
This will remove the prompt instantly before switching viewcontroller.
UPDATE
Seems like Xcode has some issues when changing the navigationBar height since main controller view is not resized accordingly.
I found a solution to do this, not sure it is the best... but it's working.
Just inherit your
viewWillAppear
andviewWillDisappear
methods in your first view controller (the one with a prompt):I didn't focus on frame size (it's for 3,5" iPhone frame sizes). You must calculate this size or you might have some issues with larger screens.
It appeared as translucent property of UINavigationBar appeared to be messed up with frame other view controllers.
I would recommend following approach.
Create a base view controller from which other view controllers will inherit as follows,
other view controllers will inherit above BaseViewController
// interface
// implementation
Other view controllers without prompt implementation will work as usual however they also needs to inherit from BaseViewController.
The top answer on this thread just solved this problem for me, thank you.
Here's the thing, the app I'm working on uses coordinators and autolayout, so looking at this showed the animation need to be shut off. I had to change the navigation controller's push view controller function's animate parameter to false.
Ex:
The best way to solve this issue is setting the background of the window during push i.e,