Reputation: 1435
When I am trying to move from one view controller to other by pressing on a table view cell in the present view controller. The problem is when I do this :
FGTipViewController *vc = [[FGTipViewController alloc] initWithNibName:@"FGTipViewController" bundle:nil];
[self.navigationController pushViewController:vc animated:YES];
It takes me to the new view controller but the navigation bar disappears. This happens for a particular view controller only and works fine for others. I am not able to make out any elementary difference between these classes. What could be the cause of this kind of problem? Let me know if more details are required.
Upvotes: 1
Views: 1358
Reputation: 1380
Try these lines when you push your view,
FGTipViewController *vc = [[FGTipViewController alloc] initWithNibName:@"FGTipViewController" bundle:nil];
[self.navigationController pushViewController:vc animated:YES];
[self.navigationController setNavigationBarHidden:NO animated:YES];
And also in the viewWillAppear method of FPTipViewController,
- (void)viewWillAppear:(BOOL)animated {
[super viewWillAppear:animated];
[self.navigationController setNavigationBarHidden:NO animated:YES];
}
Upvotes: 1
Reputation: 1435
I did this and it works. Thanks!
UINavigationBar* navBar = self.navigationController.navigationBar;
if (navBar) {
[UIView animateWithDuration:ANIMATION_DURATION animations:^{
[navBar setFrame:CGRectMake(0, 20, navBar.frame.size.width, navBar.frame.size.height)];
}];
}
Upvotes: 0
Reputation: 561
In FGTipViewController,
-(void) viewWillAppear:(BOOL) animated {
[super viewWillAppear];
[[self navigationController] setNavigationBarHidden:NO animated:YES];
}
Upvotes: 0