Unable to hide statusbar in single UIViewController

前端 未结 4 1340
感情败类
感情败类 2021-01-23 14:25

I want to hide staus bar in single view controller but my code is not working. I\'m using the below code

-(BOOL)prefersStatusBarHidden
{
    return YES;
}
         


        
4条回答
  •  说谎
    说谎 (楼主)
    2021-01-23 14:33

    To hide status bar on a single VC:

    1) Add this value to plist:

    "View controller-based status bar appearance" and set it to "YES"

    2) Add following to viewWillAppear:

    [self prefersStatusBarHidden];
    

    3) Add new method:

    -(BOOL)prefersStatusBarHidden
    {
        return YES; 
    }
    

提交回复
热议问题