Search code examples
iosiphoneipaduinavigationcontrollerstatusbar

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


Solution

  • 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!