I am making an app with navigation controllers through storyboarding in Xcode 4.2.
I want to hide all navigation bars when each view is loaded and with a click of a button which is on top of the screen, the navigation bar should show for a few seconds (I have used NStimer for that) and then hide again.
So far I have managed to do that but the problem is that when I push another view and then return to the previous view, the button can be clicked but the navigation bar is not appearing again.
Here is my code:
-(void)viewDidLoad
{
[self.navigationController setNavigationBarHidden:YES animated:YES];
}
-(IBAction)top {
[self.navigationController setNavigationBarHidden:NO animated:YES];
hideNavTimer = [NSTimer scheduledTimerWithTimeInterval:3
target:self selector:@selector (HideNav) userInfo:nil repeats:NO];
}
-(void)HideNav {
[self.navigationController setNavigationBarHidden:YES animated:YES];
[hideNavTimer invalidate];
hideNavTimer=nil;
}
I use this code in each view i push.
What am I doing wrong?