How to hide the status bar programmatically in iOS 7?

后端 未结 12 1795
眼角桃花
眼角桃花 2020-12-05 17:00

In ios7, how can I hide the statusbar programmatically? I am using XCode 4.6.1 (ios6.1) and I want to implement this in XCode itself.

12条回答
  •  误落风尘
    2020-12-05 17:52

    To hide for a specific ViewController (and then turn back on) when View controller-based status bar appearance set to NO:

    -(void)viewDidAppear:(BOOL)animated {
        [super viewDidAppear:animated];
        [[UIApplication sharedApplication] setStatusBarHidden:YES withAnimation:UIStatusBarAnimationFade];
    }
    
    -(void)viewWillDisappear:(BOOL)animated {
        [super viewWillDisappear:animated];
        [[UIApplication sharedApplication] setStatusBarHidden:NO withAnimation:UIStatusBarAnimationFade];
    }
    

提交回复
热议问题