iOS 标签栏、导航栏、状态栏隐藏

如果单个Controller可以在生命周期里设置显示和隐藏

//每次进入页面时候调用

-(void)viewWillAppear:(BOOL)animated{

[super viewWillAppear:animated];

[[UIApplication sharedApplication] setStatusBarHidden:YES];

self.navigationController.navigationBar.hidden = YES;

self.tabBarController.tabBar.hidden = YES;

}

//每次退出页面时候调用

-(void)viewWillDisappear:(BOOL)animated{

[super viewWillDisappear:animated];

[[UIApplication sharedApplication] setStatusBarHidden:NO];

self.navigationController.navigationBar.hidden = NO;

self.tabBarController.tabBar.hidden = NO;

}

如果是想把整个应用程序的状态栏都隐藏掉,操作如下

完后在AppDelegate.m的- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions方法里面加上如下一句就可以了:

[[UIApplication sharedApplication]setStatusBarHidden:YES withAnimation:UIStatusBarAnimationFade];

你可能感兴趣的:(iOS 标签栏、导航栏、状态栏隐藏)