iOS version specific info.plist settings - ios

I am in the process of updating an app for iOS7 (while still supporting iOS6), and have updated the status bar to use a white foreground using UIStatusBarStyle: UIStatusBarStyleLightContent.
However the UIStatusBarStyleLightContent value is new in iOS7, and so when run on iOS6 the UIStatusBarStyle reverts back to UIStatusBarStyleDefault, giving the light-gray with dark text iOS6 default. But I need my iOS6 version to use the black style UIStatusBarStyleBlackOpaque status bar.
Given you can set info.plist settings for different device and platform types, e.g. UIStatusBarStyle~ipad:
https://developer.apple.com/library/ios/DOCUMENTATION/iPhone/conceptual/iPhoneOSProgrammingGuide/AdvancedAppTricks/AdvancedAppTricks.html
I know I can set the value at runtime via the UIApplication, but this doesn't have an affect until after the startup image has displayed.
I am hoping you can use a similar mechanism for iOS versions? e.g:
UIStatusBarStyle: UIStatusBarStyleBlackOpaque
UIStatusBarStyle~ios7: UIStatusBarStyleLightContent
However that doesn't work and I can't find any apple documentation anywhere on such a feature. Am I out of luck and will have to live with the ugly white status bar during iOS6 app launches?
EDIT: Just found a similar question here: iOS - Entry in Info.plist for only iOS 6 and above?
Seems like the answer is no, this is not possible. Unless there have been any updates with iOS7?

Use this, As i think so, this will be helpful to you,
if (floor(NSFoundationVersionNumber) <= NSFoundationVersionNumber_iOS_6_1) {
// Load resources for iOS 6.1 or earlier, i.e set status bar here for previous versions
} else {
// Load resources for iOS 7 or later, set status bar here for ios 7
}

Related

iOS 13 dark mode objc strings

I want to disable dark mode within my app for iOS 13. And I prefer not to do so via info.plist. The reason is, plist uses a global setting, making UIUserInterfaceStyle affects earlier iOS versions aswell (creating conflicts). I only want to set it to light for iOS 13! This is my current code within my AppDelegate:
if(#available(iOS 13, *)){
window.overrideUserInterfaceStyle = UIUserInterfaceStyleLight;
}
This code snippet works for fixing statusBar color to light. But general strings within the app are still in "dark mode". Earlier white strings turn into black, and my app is already pretty dark as it is. How do I fix so strings in the app does not change it's colors by themselves in dark mode? I want a global code snippet and not go through every ViewController...
Regards
iOS ignores Info.plist keys it doesn't know. So you can safely set UIUserInterfaceStyle to Light in your Info.plist, iOS prior to version 13 will ignore this key.
Fixed the problem by calling:
self.window.overrideUserInterfaceStyle = UIUserInterfaceStyleLight;

iOS 13 DarkMode and LaunchScreen - Fallback for iOS 10

I have a blue logo on the launchscreen.storyboard on white background.
For the new DarkMode introduced with iOS 13 I like to invert the colors, i.e. blue background and white logo.
As we know this can be done using named colors from the asset catalogues, which change depending on the traits of the device.
This is working totally fine in iOS 11 and up but shows this error when trying to support iOS 10:
Named colors do not work prior to iOS 11.0.
I tried making a view controller for the launchscreen scene in code and set the colors there using the #ifavailable clause, but the compiler says a launchscreen may not have a custom class associated with it.
I also thought of using different launchscreen storyboards depending on the iOS version but I couldn't find anything about how to.
Anything I can do about it?
How to solve this problem?
Thanks,
Felix
As suggested here, the solution is to use a dynamic image for the background instead:
Create 2 images with the flat colors for light and dark mode.
Import them in your Asset Catalog and define the “Any”/“Dark” appearances.
Add a UIImageView in the background of your Launch Screen with this image (“Scale to Fill”, constrained to container).
This will compile even if your deployment target is lower than iOS 11.0, and will display the appropriate color at launch.

iOS 13 status bar hidden for all iPhone types in landscape

Our app has overridden prefersStatusBarHidden in its main view controller to return false for all situations. However, I'm getting different results while testing iOS 13.
When using the iOS 13 simulators in Xcode 11 (beta 6), they all hide the status bar (this is consistent with Apple's UIViewController documentation).
With the iOS 12 simulators, the X-model iPhones are hiding the status bar in landscape, but the other iPhone types are showing the status bar.
(Also to note, the childForStatusBarHidden property is not set anywhere in the app.)
Can anyone else confirm this behaviour? If not, what might be causing this inconsistency?
I wonder if your Settings are like this:
The TARGETS - General - Device Orientation include Portrait, LandScpaeLeft, Landsscape Right.
If your app isn't already in the app store, you can remove landscape support. If it's already online, I haven't found a solution yet.

status bar looks strange when launched in iOS 8+ device (Master-Detail template used)

My app is developed when iOS version was 6.
Recently I want to renew my app, but status bar looks strange.
I do not code so unique codes in my project, so I wonder why
battery image is shown but percentage or time clock is not shown.
(application is only run on iPad, not on iPhone)
I heard UISplitViewController is much changed after iOS8, so
maybe it is a reason.
(My app based on Master-Detail template in Xcode)
So, if anyone had a same problem and had fixed it,
tell me the reason and solution plz ?
Thanks
You can try following suggestions :
Configure your .plist file like this ,
View controller-based status bar appearance : NO
For each view controller change the status bar's Simulated Metrics property, in storyboard, from "inferred" to "Light Content"
And also go through this.

setting tint color for navigation bars reverts back to iOS 6 blue color

I have an iOS 6 application that sets the tint color for all navigation bar buttons to a green color by using the following:
[[UIBarButtonItem appearance] setTintColor:[UIColor colorWithRed:(100.0f/255.0f) green:(190.0f/255.0f) blue:(100.0f/255.0f) alpha:1.0f]];
This is done at the launch of the application. This works fine on phones running iOS 6 but on phones running iOS 7 the tint color is sometimes there and and sometimes not. It especially happens when an AlertView is displayed. This wipes out the tint color of any buttons displaying the correct green tint and reverts the buttons back to the standard iOS 6 blue tint.
To confirm it isn't something I'm doing in my larger project, I have created a basic template Master-detail xcode project to confirm and only added the above line and an alertview popup and this happens there as well.
I am wondering if 1.) anyone else is experiencing this 2.) if so, have you found a work-around and 3.) anyone know if Apple has confirmed this as a bug.
At this time we are not looking to convert this app to the iOS 7 look-and-feel so that is not an option. Thx.
From the official Apple Documentation:
In iOS 6, tintColor tinted the background of navigation bars, tab
bars, toolbars, search bars, and scope bars. To tint a bar background
in iOS 7, use the barTintColor property instead.
You should refer to the complete UI transition guide to see what UI elements behave in a different way in iOS 7. If you want to support both you can check the iOS version and put different code for each version:
if (floor(NSFoundationVersionNumber) <= NSFoundationVersionNumber_iOS_6_1) {
// Load resources for iOS 6.1 or earlier
} else {
// Load resources for iOS 7 or later
}

Resources