Reputation: 944
I started a project with Xcode 4, and today I updated my Xcode to 5. Running the same project in iOS7 simulator revealed some interesting (also frustrating) issues.
So my app has a sidebar that the user can tap on, and based on which button they tap on, I would instantiate a new VC using this code
YMGeneralInfoTableViewController *generalInfoTableVC = [self.storyboard instantiateViewControllerWithIdentifier:@"generalInfoTableVC"];
Then push this new VC onto the nav stack with this code
[self.navigationController pushViewController:generalInfoTableVC animated:YES];
Everything worked fine in iOS 6. However, in iOS7, the navbar magically disappears.
Here's a screen shot before pushing new VC
Here is after pushing it:
As you can see, there is a gap between where the content starts and the statusBar, in the position where the navBar should be.
I also tested out this code again on my iOS 6 device, everything is still fine on that iOS 6 device. So I am not sure what's going on here.
Also if I try to log the navBar/navigationItem of the controller where the navbar disappeared, I do get the correct reference to the navBar, which means that it is not nil, but simply not showing.
However, the methodsetHideNavigationBar:NO Animated:NO
didn't bring the navBar back either. Does anyone know what's going on?
Upvotes: 5
Views: 1848
Reputation: 730
By the way, I've found the solution for this.
It is because in AppDelegate, you might already set some of appearance changes for the Navigation Bar.
So what I suggest you to do is to check the device OS first before set custom apperance for Navigation Bar?
- (BOOL)isOS7
{
float currentVersion = 7.0;
if ([[[UIDevice currentDevice] systemVersion] floatValue] < currentVersion)
return NO;
return YES;
}
So if return "NO" then only you do whatever possible that can be use for
Upvotes: 1
Reputation: 12594
Checkout Autolayout constraints,
I have tried same by using iOS 6 and iOS 7, my navigation bar is showing. Still checkout Autolayout constraints, i have doen it without autolayout
Upvotes: 0