My Navigation controller requires pressing back twice in iOS5?

Up vote 1 down vote favorite share g+ share fb share tw.

I have a Navigation controller in a storyboard, currently with two screens. Screen1 contains an opening logo and some buttons, and I have hidden the navigation bar at the top using: self navigationController setNavigationBarHidden:YES; in viewDidLoad and viewWillAppear: (in viewWillAppear I have it set with animated:YES, so it slides off when coming back from other screens). When I go to Screen2, I have: self navigationController setNavigationBarHidden:NO animated:YES; in the first view controller's viewWillDisappear, and the navigation bar slides in all nicely when that view comes on to the top of the navigation stack.

Problem is, when I tap back, the navigation bar animates off the right side of the screen, but Screen2 stays there, revealing another navigation bar underneath! I can then tap back again and it will push Screen2 off and the main screen shall return, but this is not behaviour I want to pass on to any users, obviously! Anyone had this issue before, or have any points on what might be the culprit?

Edit: I just found an error appearing when I run the iOS Simulator: 2011-11-02 19:29:13.548 TestHTML510261:f803 Unbalanced calls to begin/end appearance transitions for . This happens when I click the button to go the the second view (LessonViewController). Hopefully that might be the thing to crack this, anyone know?

Iphone ios uinavigationcontroller navigation uinavigationbar link|improve this question edited Nov 2 '11 at 9:32 asked Nov 2 '11 at 1:35FreelancerJ306.

I call animated uinavigaitionbars in my apps. Have you tried just using the viewWillAppear one? Your code is correct, but my hunch (why I am not posting as an answer) is that when you call it twice it literally makes 2 navigation bars!

So delete the one in the viewDidLoad and run again. – CodaFi Nov 2 '11 at 3:32 @CodaFi Just tried it, like you said, and it didn't make a difference. It did however mean that when the app initially loaded, the navigation bar was present on the screen and then slid back off immediately.

Not quite a look I'm aiming for, on the first load :) I also checked how it acts if I took it out of viewWillAppear:, and it still doubles up, as well as (of course) leaving a nab bar on the home screen when I return. Thanks for the reply :) – FreelancerJ Nov 2 '11 at 7:46 OK, try this: In my app, I didn't have the navigation bar animations in any other controller but the one that made it disappear (i.e. , controller A does nothing and controller B makes the animations happen) so in your controller B, put this in viewWillAppear: self.

NavigationController setNavigationBarHidden:YES animated:YES; and this in viewWillDisappear: self. NavigationController setNavigationBarHidden:NO animated:animated; – CodaFi Nov 2 '11 at 15:28 Ok, gave it a shot, but it made no difference to the situation unfortunately. I still get 2011-11-02 19:29:13.548 TestHTML510261:f803 Unbalanced calls to begin/end appearance transitions for .

When I click to each new view and still have to click back twice :/ – FreelancerJ Nov 3 '11 at 1:33 1 OK, now add them back in, one at a time. First add the one that hides it in the viewWillAppear of the second view controller. Try the push, quit.

If it succeeds, then add in the showing method in the viewWillDisappear method. – CodaFi Nov 3 '11 at 2:09.

I found my IBActions, which contained: SecondViewController *X = self. Storyboard instantiateViewControllerWithIdentifier:@"X"; self. NavigationController pushViewController:X animated:NO; on each were causing the view to double up or something like that.

When I commented these two lines out in each IBAction, the problem disappeared. Thanks heaps to @CodaFi for helping me through possibilities for this, to be honest, this solution doesn't make sense to me, even thought I can see it working here.

1 Good on you! Best of luck with this. – CodaFi Nov 3 '11 at 3:18 Thanks, and thank you for helping out with this :) – FreelancerJ Nov 3 '11 at 3:20.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions