Saurabh Prajapati
Saurabh Prajapati

Reputation: 2380

Hide status bar not Working ios

I've read too many questions on this topic! but, none of this help me so i ask this question once again! What i tried till now,

--> I used below method not working for me

-(BOOL)prefersStatusBarHidden{
return YES;
}

--> Also tried this one

-(BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
[application setStatusBarHidden:YES];

return YES;
}

Status bar is initially hidden set to YES
View controller-based status bar appearance set to YES

I want to hide status bar in specific ViewController's , NOT ALL. In AppDelegate , i added NavigationController to my firstViewController and firstViewController as rootViewController as per requirement of my app.

I wish someone can help me. sorry for my English,comment below if any query to understand question

Upvotes: 1

Views: 1784

Answers (4)

Saurabh Prajapati
Saurabh Prajapati

Reputation: 2380

I found solution, so i answered it here for helping others who have same problem

As i stated i added navigationcontroller to my firstviewcontroller and thats problem!

i solved it by setting childViewControllerForStatusBarHidden property of viewcontroller! i Found it on apple Documents of prefersStatusBarHidden,Here.

Thanks to all for giving attention to this question and trying to help me!

Upvotes: 1

Tanuj
Tanuj

Reputation: 531

The plist setting "View controller-based status bar appearance" only controls if a per-controller based setting should be applied on iOS 7.

If you set this plist option to NO, you have to manually enable and disable the status bar like (as it was until iOS 6):

[[UIApplication sharedApplication] setStatusBarHidden:YES];

If you set this plist option to YES, you can add this method to each of your viewControllers to set the statusBar independently for each controller (which is esp. nice if you have a smart subclass system of viewControllers)

- (BOOL)prefersStatusBarHidden {
    return YES;
}

Upvotes: 1

iAnurag
iAnurag

Reputation: 9346

Add this method to your viewController

- (BOOL)prefersStatusBarHidden
{
return YES;
}

may be this will help you.

Upvotes: 1

poojathorat
poojathorat

Reputation: 1220

Add the following to your Info.plist:

<key>UIStatusBarHidden</key>
<true/>
<key>UIViewControllerBasedStatusBarAppearance</key>
<false/>

& also try this

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

Upvotes: 3

Related Questions