iOS 隐藏导航栏,出现一闪问题解决
2018-10-29 本文已影响0人
Sim_Liu
问题:self.navigationController隐藏导航栏返回上一层,使用方法为
- (void)viewWillAppear:(BOOL)animated{
[superviewWillAppear:animated];
self.navigationController.navigationBar.hidden = YES;
}
- (void)viewWillDisappear:(BOOL)animated {
[super viewWillDisappear:animated];
self.navigationController.navigationBar.hidden = NO;
}
会出现返回上一层一闪的情况。
解决:
用如下方法代替
[self.navigationController setNavigationBarHidden:YES animated:YES];
[self.navigationController setNavigationBarHidden:NO animated:YES];