wiruzx
wiruzx

Reputation: 481

UINavigationBar disappears iOS7

I have some wierd bug with UINavigationBar.

Sometimes it just disappears (actually if you move view to the half of screen, and then just release it)

gif 5,3mb

Video example

In the first ViewController's viewWillAppear: method i call:

[self.navigationController setNavigationBarHidden:NO animated:YES];

The second ViewController's viewWillAppear: contains:

[self.navigationController setNavigationBarHidden:YES animated:NO];

I tried change animated: parameter, but it doesn't help.

Is it iOS7 bug or I just doing something wrong?

Upvotes: 3

Views: 1265

Answers (3)

Lings
Lings

Reputation: 124

I got the same problem, and fixed it. the solution is:

  1. Modify info.plist, set "View controller-based status bar appearance " to NO;

  2. Delete all - (UIStatusBarStyle)preferredStatusBarStyle {} ;

  3. If your view controller has different status bar style, use [[UIApplication sharedApplication] setStatusBarStyle:UIStatusBarStyleLightContent];

    e.g. in viewWillAppear set to light, in disappear ,set to dark style.

Upvotes: 1

wiruzx
wiruzx

Reputation: 481

I found the reason for this. That's happened because in info.plist

View controller-based status bar appearance is equal to YES

If change it to NO, then all will be fine

Upvotes: 2

monder
monder

Reputation: 399

You should define appearance per navigation controller. If you want to have a navigation bar on the second controller only you should do the following in that particular controller:

- (void)viewWillAppear:(BOOL)animated
{
    [super viewWillAppear:animated];
    [self.navigationController setNavigationBarHidden:NO animated:YES];
}

- (void)viewWillDisappear:(BOOL)animated
{
    [super viewWillDisappear:animated];
    [self.navigationController setNavigationBarHidden:YES animated:YES];
}

That way it will event work if you would need to change order of your controllers.

Upvotes: 0

Related Questions