實(shí)現(xiàn)原理
以個(gè)人中心為例动雹,產(chǎn)品設(shè)計(jì)個(gè)人中心沒有導(dǎo)航欄,所以在viewWillAppear設(shè)置hidden = YES概耻;而跳轉(zhuǎn)到下一界面的時(shí)候又有導(dǎo)航欄权逗,所以在個(gè)人中心視圖將要消失的時(shí)候hidden = NO 即寫在viewWillDisappear里面。
注意點(diǎn):
[self.navigationController setNavigationBarHidden:YES]設(shè)置的時(shí)候捣染,使用側(cè)滑返回時(shí)候稍微一滑動(dòng)導(dǎo)航欄中的title 返回按鈕便消失了骄瓣。不想讓他一滑動(dòng)立馬消失,這時(shí)候就要用這行代碼耍攘,加上animated :[self.navigationController setNavigationBarHidden:YES animated:YES];
- (void)viewWillAppear:(BOOL)animated{
[super viewWillAppear:animated];
[self.navigationController setNavigationBarHidden:YES animated:YES];
// [self.navigationController setNavigationBarHidden:YES]
}
- (void)viewWillDisappear:(BOOL)animated{
[super viewWillDisappear:animated];
[self.navigationController setNavigationBarHidden:NO animated:YES];
// [self.navigationController setNavigationBarHidden:YES]
}