status bar became visible after dismiss UIImagePicker in iOS 8 - ios

getting strange issue in iOS 8
i have made made
View controller-based status bar appearance is NO in info.plist file
implemented following methods
-(void)navigationController:(UINavigationController *)navigationController
willShowViewController:(UIViewController *)viewController
animated:(BOOL)animated
{
[[UIApplication sharedApplication] setStatusBarHidden:YES];
}
-(BOOL)prefersStatusBarHidden;
{
return YES;
}
the problem is when i navigate to photo gallery at time status bar is hidden , but after dismissing it , status bar became visible for entire app .
Thanks.

You need to hide status bar in view will apear of the class in which you are calling imagepicker using below code.
[[UIApplication sharedApplication] setStatusBarHidden:YES withAnimation:NO];

From Plist
Status bar initially hidden Select YES
ViewController Based Status bar Set to NO.
it will work the trick.

Related

Can't hide status bar on launch

I'm building an iOS 9 app with horizontal pages navigation and need to show the status bar on some pages, and hide it on others. I want to use the fade in/out animation so I have to set
View controller-based status bar appearance = NO
and update the status bar like this:
[[UIApplication sharedApplication] setStatusBarHidden:YES withAnimation:UIStatusBarAnimationFade];
This procedure works perfectly when navigating between pages, but I can't get rid of the status bar on launch.
I have tried setting: Status bar is initially hidden = YES
Adding this to the NavigationControllers viewDidLoad:
[[UIApplication sharedApplication] setStatusBarHidden:YES];
self.statusBarHidden = YES;
[self setNeedsStatusBarAppearanceUpdate];
Adding this to AppDelegates didFinishLaunchingWithOptions:
application.statusBarHidden = YES;
Adding this to the ViewController of the initial page:
- (BOOL)prefersStatusBarHidden {
return YES;
}
Checking the "Hide status bar" option in General->Deployment Info
And setting "Status Bar" to "None" in the linked storyboard element
But the status bar is still showing up on launch. How can I get rid of the status bar on launch without changing the value of View controller-based status bar appearance ?
Just tick the hide status bar in project setting as below.
Project setting - For hiding the status bar at launch of app.
Add below in viewController for which you need to hide.
- (BOOL)prefersStatusBarHidden {
return YES;
}
/------ UPDATE -----/
With tick of hide status bar
Without tick of hide status bar
/------ Animate Status Bar -----/
In plist.
View controller-based status bar appearance = NO
Then in viewWillAppear method.
[[UIApplication sharedApplication] setStatusBarHidden:YES withAnimation:UIStatusBarAnimationFade];
changing plist file :
set Status bar is initially hidden = YES
add row: View controller-based status bar appearance = NO
Goto Targets->General->Deployment Info: and under that select Hide Status Bar option.
Turns out what I was doing was correct, but there was an errant [[UIApplication sharedApplication] setStatusBarHidden:NO]; buried in inherited code. I grepped it, but overlooked that line...
(use git grep StatusBar to find lines of code in a git repo that mutate the status bar)
Also, the only code needed is:
View controller-based status bar appearance = NO (in plist)
[[UIApplication sharedApplication] setStatusBarHidden:YES withAnimation:UIStatusBarAnimationFade];
anywhere the status bar needs updating (usually in viewWillAppear)
In order to achieve what you are looking for you need set in the app.plistfile:
Status bar is initially hidden to YES
View controller-based status bar appearance to NO
Then in every view controller to show it
[[UIApplication sharedApplication] setStatusBarHidden:NO];
or to hide it:
[[UIApplication sharedApplication] setStatusBarHidden:YES];

iOS Status bar turned black by Photo Framework

My app uses white status bar text throughout. I've accomplished this through numerous settings below:
1/ In Info.plist I set: View controller-based status bar appearance to "NO"
2/ In - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions I set [[UIApplication sharedApplication] setStatusBarStyle:UIStatusBarStyleLightContent];
3/ I implemented the following in the VC I am asking about here:
- (UIStatusBarStyle) preferredStatusBarStyle {
return UIStatusBarStyleLightContent;
}
4/ In Storyboard I set the Navigation Bar Style to "Black"
So, a ton of different ways to make sure a simple status bar stays with white text. This is working throughout except for when the users goes to the picture library or the user goes to take a picture. This of course launches Apple's framework which uses a black status bar. That is fine for those controllers as again they are dictated by Apple. However, when the user then cancels or chooses an image and are returned to my controllers, the status bar stays black. I've tried the following when it returns: [self setNeedsStatusBarAppearanceUpdate] but that also does not work.
How can I get the status bar to return to white text after it returns from the Apple controlled photo picker views? I am working with iOS 8 although a check shows that this same problem occurs in 7.1. This happens with both the simulator and real devices.
I found the answer which was to repeat what I did in my step 2 above within the VC that the image picker returns to. So in viewWillAppear I execute: [[UIApplication sharedApplication] setStatusBarStyle:UIStatusBarStyleLightContent]; again. Seems like a lot of different ways just to get a status bar to stay white, but now it does under all circumstances.
I guess it will resolve your problem as it resolves mine
Write the code for UIImagePicker and its delegate, add willShowViewController method which is delegate of UINavigationController.
There set the status bar style to LightContent.
- (void)navigationController:(UINavigationController *)navigationController
willShowViewController:(UIViewController *)viewController
animated:(BOOL)animated {
if (([navigationController isKindOfClass:[UIImagePickerController class]] &&
(((UIImagePickerController *)navigationController).sourceType == UIImagePickerControllerSourceTypeCamera)) || (((UIImagePickerController *)navigationController).sourceType == UIImagePickerControllerSourceTypePhotoLibrary))
{
[[UIApplication sharedApplication] setStatusBarHidden:NO];
[[UIApplication sharedApplication] setStatusBarStyle:UIStatusBarStyleLightContent];
}
}

Cannot hide status bar cocos2d iOS 7

I tried to add View controller-based status bar appearance: NO and Status bar is initially hidden: YES to plist, [[UIApplication sharedApplication] setStatusBarHidden:YES withAnimation:UIStatusBarAnimationNone] and - (BOOL) prefersStatusBarHidden to CCDirectorIOS and AppDelegate, no one works.
There's something I am missing?
Add below given function to CCDirector.m file.
(BOOL)prefersStatusBarHidden {return YES;}
In your Info.plist set Status bar is initially hidden to YES and View controller-based status bar appearance to NO.
See more here: https://www.makegameswith.us/gamernews/279/hiding-status-bar-ccmenu-fix-ios7

to change Status Bar text colour to white permanently throughout my app in iOS 7

I changed the status bar text colour to white,when I open camera roll in my app, it again sets status bar text colour to black, and when I dismiss camera roll status bar in my app has black text.
[[UIApplication sharedApplication] setStatusBarStyle:UIStatusBarStyleLightContent];
- (void)navigationController:(UINavigationController *)navigationController willShowViewController:(UIViewController *)viewController animated:(BOOL)animated
{
[[UIApplication sharedApplication] setStatusBarStyle:UIStatusBarStyleLightContent];
}
solved my problemmm
You can also do this with out writing code
On you project plist file:
Set the
Status bar style:
UIStatusBarStyleLightContent
View controller-based status bar appearance: NO
Status bar is initially hidden: NO

How to hide status bar in iOS 7?

I have tried setting the following in my app .plist file:
View controller-based status bar appearance: NO
And while this removes it from my initial view controller, once I go to another view and come back with my navigation controller, it comes right back and this time it does not disappear. Also, I don't see why it would matter but I have also set the status bar under simulated metrics to "None" but that doesn't seem to help. I know i am going to have the navigation bar but the status bar I need gone.
How can I get this done? Please provide a detailed answer, sample code would be great!
Update: This is NOT a duplicate solution as I have tried all other solutions and NONE seem to work for me. Most recently I tried
[[UIApplication sharedApplication]setStatusBarHidden:YES withAnimation:UIStatusBarAnimationNone];
Again, with no results. When the app initially launches a status bar is NOT present, after the user visits another view, the status bar is now present in the 2 and other views and does not go away. Even if you go back to the main view.
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:
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.

Resources