- (void)viewWillDisappear:(BOOL)animated {
NSArray *viewControllers = self.navigationController.viewControllers;//獲取當(dāng)前的視圖控制其
if (viewControllers.count > 1 && [viewControllers objectAtIndex:viewControllers.count-2] == self) {
//當(dāng)前視圖控制器在棧中,故為push操作
NSLog(@"push");
} else if ([viewControllers indexOfObject:self] == NSNotFound) {
//當(dāng)前視圖控制器不在棧中祖乳,故為pop操作
NSLog(@"pop");
}
}
[self.navigationController setNavigationBarHidden:YES animated:animated];
設(shè)置是否隱藏導(dǎo)航欄砸西,隱藏view界面上移
[self.navigationController.navigationBar setBarTintColor:KMainColor];設(shè)置導(dǎo)航欄的顏色
[self.navigationController.navigationBar setBarStyle:UIBarStyleBlackTranslucent];
設(shè)置導(dǎo)航欄的風(fēng)格
UIBarStyleDefault:文字顏色為黑色
UIBarStyleBlack = 1,
UIBarStyleBlackOpaque = 1,
UIBarStyleBlackTranslucent = 2
文字顏色為白色
self.navigationController.navigationBar.translucent = YES;表示view從0,0開(kāi)始
self.navigationController.navigationBar.translucent = NO;表示view從navigationBar下方開(kāi)始