How to hide status bar in iOS 7?

匆匆过客 提交于 2019-12-06 14:01:29

I have tried all of the suggestions that were posted here, unfortunately what happened here was a small mistake, in my viewDidLoad I had:

[[UIApplication sharedApplication] setStatusBarHidden:YES];

But in my viewWillAppear I had:

[[UIApplication sharedApplication] setStatusBarHidden:NO];

So this was just an issue of overriding, problem fixed now.

To hide status bar:

if [View controller-based status bar appearance: NO]: in AppDelegate.m call

[[UIApplication sharedApplication]setStatusBarHidden:YES];

else: in every view controller

- (BOOL)prefersStatusBarHidden
{
    return YES;
}

Try this 2 steps:

  1. In .Plist file of project set the property:

View controller-based status bar appearance = NO;

and 2.In all view controller's .m file in viewDidLoad method put this line of code:

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

Use this method in the View Controller which you'd like the Status Bar hidden:

- (BOOL)prefersStatusBarHidden {
    return YES;
}

This should work :

// In iOS7 this gets called and hides the status bar so the view does not go under the top iPhone
// status bar

- (BOOL)prefersStatusBarHidden {
      return YES;
}

none of these work for me. when i try this method i get the message "use of undeclared identifier preferstatusbarHidden

include - (BOOL)prefersStatusBarHidden {
      return YES;
}

I don't know what to do anymore. I tried setStatusBarHidden, prefersHiddenStatusBar and still no results. Finally i have went through the below you tube link :

https://www.youtube.com/watch?v=FtpBXdMSqRQ

It worked for me.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!