Created
June 14, 2014 06:49
-
-
Save wanggang316/c5c4b66f527c42252afd to your computer and use it in GitHub Desktop.
UINavigationController的几个问题
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//1.UINaivgationController的bar有的需要隐藏,有的需要显示 | |
//这时候可以重写UINavigationControllerDelegate的 | |
- (void)navigationController:(UINavigationController *)navigationController willShowViewController:(UIViewController *)viewController animated:(BOOL)animated { | |
if ( viewController == [MyViewController class]) { | |
[navigationController setNavigationBarHidden:YES animated:animated]; | |
} else if ( [navigationController isNavigationBarHidden] ) { | |
[navigationController setNavigationBarHidden:NO animated:animated]; | |
} | |
} | |
//但是这样push或者pop的时候navigation bar会有白边出现,也就是说bar隐藏或者显示的比较晚 | |
//你可以这样做 | |
//在你需要显示的bar的controller里 | |
- (void)viewWillAppear:(BOOL)animated { | |
[super viewWillAppear:animated]; | |
[self.navigationController setNavigationBarHidden:YES animated:YES]; | |
} | |
//隐藏则设置hidden位NO |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment