你需要隱藏內部viewWillAppear中視圖1的導航欄,取消隱藏,同時要viewWillDisappear:
視圖1:
- (void)viewWillAppear:(BOOL)animated
{
[super viewWillAppear:animated];
[self.navigationController.navigationBar setHidden:true];
}
- (void)viewWillDisappear:(BOOL)animated
{
[super viewWillDisappear:animated];
[self.navigationController.navigationBar setHidden:false];
}
視圖2:
- (void)viewWillAppear:(BOOL)animated
{
[super viewWillAppear:animated];
[self.navigationController.navigationBar setHidden:false];
}
- (void)viewWillDisappear:(BOOL)animated
{
[super viewWillDisappear:animated];
[self.navigationController.navigationBar setHidden:true];
}
任何一個您可以使用類函數,view1函數或view2函數來隱藏並切換控制器時取消隱藏導航欄。