- (void)viewWillDisappear:(BOOL)animated {
NSArray *viewControllers = self.navigationController.viewControllers;//获取当前的视图控制其
if (viewControllers.count > 1 && [viewControllers objectAtIndex:viewControllers.count-2] == self) {
//当前视图控制器在栈中,故为push操作
NSLog(@"push");
} else if ([viewControllers indexOfObject:self] == NSNotFound) {
//当前视图控制器不在栈中,故为pop操作
NSLog(@"pop");
}
}
[self.navigationController setNavigationBarHidden:YES animated:animated];
设置是否隐藏导航栏,隐藏view界面上移
[self.navigationController.navigationBar setBarTintColor:KMainColor];设置导航栏的颜色
[self.navigationController.navigationBar setBarStyle:UIBarStyleBlackTranslucent];
设置导航栏的风格
UIBarStyleDefault:文字颜色为黑色
UIBarStyleBlack = 1,
UIBarStyleBlackOpaque = 1,
UIBarStyleBlackTranslucent = 2
文字颜色为白色
self.navigationController.navigationBar.translucent = YES;表示view从0,0开始
self.navigationController.navigationBar.translucent = NO;表示view从navigationBar下方开始