1.导航栏的显示与隐藏:
- (void)viewWillAppear:(BOOL)animated {
[super viewWillAppear:animated];
self.navigationController.navigationBarHidden = YES;
}
- (void)viewWillDisappear:(BOOL)animated {
[super viewWillDisappear: animated];
self.navigationController.navigationBarHidden = NO;
}
2.状态栏的显示与隐藏:
实现之前需要在Info.plist配置:
Status bar is initially hidden 设为 YES
-
View controller-based status bar appearance 设为 NO
这样才会起作用。
- (void)viewWillAppear:(BOOL)animated {
[super viewWillAppear:animated];
[UIApplication sharedApplication].statusBarHidden = YES;
}
- (void)viewWillDisappear:(BOOL)animated {
[super viewWillDisappear: animated];
[UIApplication sharedApplication].statusBarHidden = NO;
}