UIImagePickerController hiding status bar iOS 8 - ios

I want the status bar hidden in my app. In my pList I have set:
Status Bar is initially hidden - YES
View controller-based status bar appearance - NO
This works fine until I present an UIImagePickerController. It wants to show the status bar. So in willShowViewController for the navigationController delegate I call [[UIApplication sharedApplication] setStatusBarHidden:YES]. This does in fact hide the status bar but there is a shifting like an animation in the navigationController. I've spent some time trying to stop this animation. Anyone have any ideas how to stop it? Thanks.

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

Subclass UIImagePickerController and define prefersStatusBarHidden method, return YES if you want to hide a status bar.

It turns out that this a bug in iOS 8. I filed a radar bug and Apple suggested I try the beta 8.3. With the beta I no longer see the animation.

Related

iOS 7 red status bar

When Shazam is opened the status bar turns red and doubles it's height because of background recording, but this ruins the UI in my app. I'm now trying to change my code to support different status bar sizes, because the red status bar is also opaque, but I can't come up with a general solution because of this:
When the status bar is initially red, when I launch my app, the launch image is scaled and ruined. How to fix this?
Note: My app does NOT use recording.
[Edit]
The only solution I found was to set 'Status bar is initially hidden' to YES in .plist. I don't really need the status bar to be visible on app launch, especially if it affects my launch image when the status bar is taller than usual, i.e. when recording or during a phone call.
[Edit 2]
There are cases when the launch image will be briefly visible when the app is brought to foreground from background state. To work around this I use view-controller based status bar appearance:
- (BOOL)prefersStatusBarHidden
{
if ([[UIApplication sharedApplication] applicationState] == UIApplicationStateBackground)
{
return YES;
}
return NO;
}
This ensures the status bar is always hidden when the app comes to foreground, so the launch image will never be affected. Don't forget to call setNeedsStatusBarAppearanceUpdate on appDidEnterBackground and (inside an animation block) on appDidBecomeActive notifications.
The red status bar is a system function. You are not going to be able to work around this - and it isn't really your 'fault' if the launch screen looks like that - if the user wants to open your app while using Shazam, they are going to see the red bar and the launch image is going to be scaled. You could change the launch image to look good when scaled, but then it would look bad the rest of the time (when the red bar wasn't at the top of the screen on launch).
After a long long long long long research and hurdles I found out simple solution for this follow as below
In Targets->General->Deployment Info check the HideStatusBar Option
like below!
And in the ViewController (Which one you kept as RootViewController) in viewDidAppear add this line of code...
[[UIApplication sharedApplication] setStatusBarHidden:NO];
Because when you uncheck HideStatusBar Option and your app needs any background process or audio related process then the status bar will become red with enlarged height. If you dont want status bar in entire app then dont add the above line in viewDidAppear and check HideStatusBar Option.

IOS 7 Status bar keeps appearing

I have used the two methods to remove the status bar ( the one with the time and the signal strength )but it keeps reappearing in my app for IOS 7
I have used the ' hide during application launch ' in GENERAL SETTINGS
I have added the ' status bar is initially hidden' BOOL to YES
I have changed the status bar to NONE in every View Controller
The problem occurs when i return after having accessed the IPHONE photo library to import a picture into my APP , and only then , it seems to override any previous entries in the PLIST
Does anyone have any code to permanently disable this status bar so it does not appear?
Thanks
* I have tried all the options listed but still when my app returns from opening and selecting from the photo gallery the status bar re-appears *
You need implement 2 steps for to hide status bar accross your app:
1) didFinishLaunchingWithOptions
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
// Override point for customization after application launch.
[[UIApplication sharedApplication]setStatusBarHidden:YES];
.......
}
2) And .plist file of your project
Add method in your view controller implementation.
- (BOOL)prefersStatusBarHidden {
return YES;
}
You can get rid of this by adding an entry in the .plist file of your project
"View controller-based status bar appearance" set its boolean value to "NO"

objective-c how to programatically landscape keyboard when device rotates

I have a UIWebWiew in a UIViewController that I want be able to be in landscapemode.
That is done.
But the keyboard gets stuck still in portraitmode when a textfield is taped.
So I added the redpart of the code
[[UIApplication sharedApplication] setStatusBarOrientation: UIInterfaceOrientationLandscapeLeft];
Because I read that with that the keyboard will decide itself how to rotate. But that did nothing.
Any one got ideas on how I should do?

Statusbar and layout issues with UIImagePickerController after rotation

tl;dr: User interface layout is broken when rotating the iPad while taking a photo, if the app displays a status bar.
I've got an app that shows a status bar that should take photos through a UIImagePickerController.
I'm running this on an iPad 3, iOS 6 with Xcode 4.51
The first problem I noticed was that if I didn't hide the statusbar via
[[UIApplication sharedApplication] setStatusBarHidden:YES withAnimation:UIStatusBarAnimationNone];
before the call to
[self presentViewController:imagePicker animated:YES completion:nil];
Then the UIImagePickerController would not be shown correctly on the screen. The space for the status bar would still be reserved (but no time or battery information etc. shown) with the result that the controls at the lower end of the screen would be partly off-screen.
So, I added the line
[[UIApplication sharedApplication] setStatusBarHidden:YES withAnimation:UIStatusBarAnimationNone];
before presenting the UIImagePickerController and the first problem was solved.
Now comes the second problem (caused by the solution to the first problem). When I bring up the UIImagePickerController, rotate the iPad and close it (via "cancel" or "use", doesn't matter), the handler (either imagePickerControllerDidCancel or imagePickerController:didFinishPickingMediaWithInfo: gets called, in which I show the status bar again, via
[[UIApplication sharedApplication] setStatusBarHidden:NO withAnimation:UIStatusBarAnimationNone];
The problem is now that the status bar is shown in fact, but the rest of the app seems to be unaware that it is on the screen again. (The UIToolbar that I have on my "MainViewController" is partly hidden behind the status bar.) The interesting thing is, if I rotate the iPad to any other orientation all is displayed correctly again after the animation finishes.
Can anybody give me any tips on how to solve this problem? (Currently my best work around would be to leave the status bar hidden after the first time somebody took a photo, but that's kind of sub-optimal). Maybe there is a better solution to the first problem, or maybe a method to solve both issues.
Further information: After rotating the iPad to landscape while UIImagePickerController was active, this is the frame of my MainViewController's view frame: {{0, 0}, {1024, 768}} (i.e. in the case where there is the problem). When I have the iPad in landscape orientation all the time, this is the MainViewController's view frame after the UIImagePickerController is dismissed: {{0, 0}, {1024, 748}} (This is the case where there is no problem.)
Thanks in advance for your attention and effort!
I just came across the same issue on iPhone when displaying an image picker that takes an image from the camera. The solution I found was to make a call to show the statusbar when the view that popped up the image picker will re-appear. Eg.
- (void)viewWillAppear:(BOOL)animated
{
[super viewWillAppear:animated];
[[UIApplication sharedApplication] setStatusBarHidden:NO withAnimation:UIStatusBarAnimationSlide];
}

iOS 4.3 Statusbar hidden shows white bar

I have slideshow developed for iOS 5, now im going to port it to iOS 4.3, when it show in full screen need to hide status bar in iOS 5 it is working properly but in iOS 4.3 status bar goes hidden but shows white stripe on top of view.the problem is how to hide statusbar in iOS 4.3 without white stripe.
This is the code use to hide status bar
Method 1
[[UIApplication sharedApplication] setStatusBarHidden:YES];
Method 2
[[UIApplication sharedApplication] setStatusBarHidden:YES withAnimation:UIStatusBarAnimationFade];
method 1 or method 2 didn't worked for ios4.3.
write down the code in which view controller u want to hide the Status bar.
-(void)viewWillAppear:(BOOL)animated{
[[UIApplication sharedApplication] setStatusBarHidden:YES animated:YES];
}
If you haven't figured this out yet, you'll also need to make sure that every involved view controller xib has the "Status Bar" set to none.

Resources