iOS

iOS隐藏状态栏

2016-10-20  本文已影响221人  肉身佛陀

1.整个项目隐藏状态栏

在Targets->General->勾选中Hide status bar .


整个项目隐藏状态栏

2.单个界面隐藏状态栏,例如登录注册页面

//进入时隐藏
-(void)viewWillAppear:(BOOL)animated
{
    [super viewWillAppear:animated];
    //隐藏=YES,显示=NO; Animation:动画效果
    [[UIApplication sharedApplication] setStatusBarHidden:YES withAnimation:UIStatusBarAnimationNone];
}
//退出时显示
-(void)viewWillDisappear:(BOOL)animated
{
    [super viewWillDisappear:animated];
//隐藏=YES,显示=NO; Animation:动画效果
    [[UIApplication sharedApplication] setStatusBarHidden:NO withAnimation:UIStatusBarAnimationNone];
}

3.启动页隐藏状态栏,进入程序后正常显示状态栏

-(BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions 
{
    [application setStatusBarHidden:NO withAnimation:UIStatusBarAnimationFade];
}

用来记录平时遇到的问题,不对之处还望斧正,如有好的见解还望指教.

上一篇下一篇

猜你喜欢

热点阅读