当我尝试通过按下当前视图控制器中的表格视图单元格从一个视图控制器移动到另一个视图控制器时。问题在于我这样做:
FGTipViewController *vc = [[FGTipViewController alloc] initWithNibName:@"FGTipViewController" bundle:nil];
[self.navigationController pushViewController:vc animated:YES];
它带我到新的视图控制器,但导航栏消失。这仅适用于特定的视图控制器,适用于其他视图控制器。我无法弄清楚这些课程之间的任何基本差异。可能是造成这类问题的原因是什么?如果需要更多详细信息,请与我们联系。
答案 0 :(得分:1)
推视时尝试这些行
FGTipViewController *vc = [[FGTipViewController alloc] initWithNibName:@"FGTipViewController" bundle:nil];
[self.navigationController pushViewController:vc animated:YES];
[self.navigationController setNavigationBarHidden:NO animated:YES];
还有FPTipViewController的viewWillAppear方法,
- (void)viewWillAppear:(BOOL)animated {
[super viewWillAppear:animated];
[self.navigationController setNavigationBarHidden:NO animated:YES];
}
答案 1 :(得分:0)
在FGTipViewController中,
-(void) viewWillAppear:(BOOL) animated {
[super viewWillAppear];
[[self navigationController] setNavigationBarHidden:NO animated:YES];
}
答案 2 :(得分:0)
我做了这个并且它有效。谢谢!
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)];
}];
}