我的实践
1.在BaseViewController中,当viewWillAppear时,根据情况显示或隐藏导航栏
BaseViewController.h
#import "QqcBaseViewController.h"
@interface BaseViewController : QqcBaseViewController
#pragma mark - polymorphy
//是否需要显示导航栏
- (BOOL)isHideNavigationbar;
@end
BaseViewController.m
#import "BaseViewController.h"
@implementation BaseViewController
#pragma mark - polymorphy
//是否需要显示导航栏
- (BOOL)isHideNavigationbar {
return NO;
}
#pragma mark - system framework
- (void)viewWillAppear:(BOOL)animated {
[super viewWillAppear:animated];
//是否显示导航栏
BOOL isHideNavi = [self isHideNavigationbar];
[self.navigationController setNavigationBarHidden:isHideNavi animated:YES];
}
@end
2.在SomeoneViewController中, 定制是否隐藏导航栏
- (BOOL)isHideNavigationbar {
return YES;
}
网友评论