3

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?

wiruzx
  • 491
  • 3
  • 17
  • did u try self.navigationcontroller.navigationbarhidden = NO;? Or do you have xib wihich contain no navigation bar? Setup xib file navigationbar type as transulent bnavigationbar.other than try to analyze the navigationbarhidden statements. – iOSdev Jan 13 '14 at 11:28
  • @NarasimhaiahKolli Yes, I tried this. It's the same as [self.navigationController setNavigationBarHidden:NO animated:NO]. – wiruzx Jan 13 '14 at 11:44
  • @NarasimhaiahKolli and i have xib only just for first ViewController – wiruzx Jan 13 '14 at 12:10
  • you have to add transulent navigationbar to viewcontroller xib.just goto inspector properties of xib and add navigationbar to xib. – iOSdev Jan 13 '14 at 12:25
  • @NarasimhaiahKolli nothing changed. Navigation bar still disappears – wiruzx Jan 13 '14 at 12:33
  • Did you check this ? http://stackoverflow.com/questions/2813118/prevent-a-uisearchdisplaycontroller-from-hiding-the-navigation-bar – iOSdev Jan 13 '14 at 12:37
  • @NarasimhaiahKolli it's about UISearchDisplayController – wiruzx Jan 13 '14 at 12:41

3 Answers3

2

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

wiruzx
  • 491
  • 3
  • 17
1

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.

Lings
  • 124
  • 1
  • 8
0

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.

monder
  • 379
  • 3
  • 7
  • In this case Navigation Bar disappears before hiding ViewController, and on top I have black space. – wiruzx Jan 13 '14 at 11:32
  • Check that animated flag is set to `YES`. If I set that to `NO` I see the exact same thing as you described. – monder Jan 13 '14 at 11:46
  • If i setNavigationBarHidden in viewWillDisappear of second controller it's the same as on gif. If i set it in viewWillDisappear of second and viewWillAppear of first, i have black space. Something like that – wiruzx Jan 13 '14 at 11:52