UINavigationController点击事件控制隐藏与显示(UITabBarController也同样适用)

来源:互联网 发布:王治郅在nba数据 编辑:程序博客网 时间:2024/05/11 17:56
@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

原创粉丝点击