@interface ViewController ()
{
BOOL isflage;
}
@end
@implementation ViewController
- (void)viewDidLoad
{
[super viewDidLoad];
// Do any additional setup after loading the view from its nib.
isflage = YES;
[self.navigationController setNavigationBarHidden:isflage animated:YES];
}
#pragma mark onClick
-(void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event
{
isflage = !isflage;
[self.navigationController setNavigationBarHidden:isflage animated:YES];
}
@end
上述代码的实现结果就是:
先隐藏navigationController,之后点击会显示,再点击又会隐藏,超简单吧。
同样tabBarController也是同样的实现结果。
tabBarController