Problem with navigation bar in Xcode 5

I am using a navigation controller in my application. Basically, all controllers have a hidden navigation bar, with the exception of one controller. When I exit this controller, the navigation bar appears strange, and the bottom space near the navigation bar remains. Also, when I start editing or making some choice or something else, the navigation bar becomes normal and the empty space is deleted, but remains until I do nothing. I use Xcode 5, and this happens in both iOS 6 and iOS 7, not tested in iOS 5. In light of the disappearance of this controller, I

self.navigationController.navigationBar.hidden = FALSE;
[self.navigationController setNavigationBarHidden:NO];

A view of another controller that I wrote will also appear.

self.navigationController.navigationBar.hidden = FALSE;
[self.navigationController setNavigationBarHidden:NO];

In both cases, the automatic layout is false, since I need to dynamically change the frame in different conditions. Please, help.

+3
source share
2 answers

Use the code below.

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

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

Use willAppear / Disappear instead.

+3
source

In my case, I removed this empty space by setting the background color as a navigation bar. as

[[[self navigationController] view] setBackgroundColor:[UIColor colorWithPatternImage:[UIImage imageNamed:@"background.png"]]];
0
source

All Articles