-3

I'm trying to change the tint color of the navigation controller of the Launchscreen to white

I'm trying to add that code to my AppDelegate, it's working on all ViewControllers except for the LaunchScreen:

navigationController.navigationBar.barStyle = UIBarStyle.Black
navigationController.navigationBar.tintColor = UIColor.whiteColor()

the tint color is black, I want to change it to white.

enter image description here

Tobi Nary
  • 4,566
  • 4
  • 30
  • 50
Stranger B.
  • 9,004
  • 21
  • 71
  • 108

5 Answers5

1

That is not a UINavigationBar, that is a UIStatusBar. Use

UIApplication.sharedApplication.statusBarStyle = .LightContent

(cf. doc, deprecated in iOS 9)

For iOS 9, View Controllers decide this 'themselves', so whatever view controller is instantiated for your splash screen storyboard should override

func preferredStatusBarStyle() -> UIStatusBarStyle

and return .LightContent. (cf. doc)

Tobi Nary
  • 4,566
  • 4
  • 30
  • 50
  • 1
    Also, there seems not to be any NavigationController. – Tobi Nary Feb 24 '16 at 12:30
  • What is the easiest way to set the color *app wide*? Is setting the plist value as seen in [my answer](http://stackoverflow.com/a/35602314/3947107) 'deprecated' as well? – Kymer Feb 25 '16 at 16:55
  • Use a base class you inherit from in all other view controllers that implements this. – Tobi Nary Feb 25 '16 at 16:56
  • But the usage of that plist key can't be considered deprecated, right? (can't find related info in Apple's [iOS Information Property List Key Reference](https://developer.apple.com/library/ios/documentation/General/Reference/InfoPlistKeyReference/Articles/iPhoneOSKeys.html#//apple_ref/doc/uid/TP40009252-SW1)). So isn't that the easiest way to globally set the color? – Kymer Feb 25 '16 at 17:07
  • It would be, if you could set it in iOS 9 using `statusBarStyle`, but I couldn't find a way to do so. Yet, depending on your code base, it's no big deal to insert an implementation for that in a base class and derive from e.g. `UIStatusBarViewController` instead of `UIViewController` – Tobi Nary Feb 25 '16 at 17:10
  • What do you mean? Doesn't it say: "UIStatusBarStyle, “Status bar style”, Specifies the style of the status bar as the app launches. See [UIStatusBarStyle](https://developer.apple.com/library/ios/documentation/General/Reference/InfoPlistKeyReference/Articles/iPhoneOSKeys.html#//apple_ref/doc/uid/TP40009252-SW14) for details." – Kymer Feb 25 '16 at 17:15
  • I See; we were talking about different keys. Then: give it a try; should work. – Tobi Nary Feb 25 '16 at 17:16
0

Setting status bar color app wide

If you want to set the color of the status bar app wide (in the launch screen as well) you should add this to your info.plist (right click > Add row):

Status bar style = UIStatusBarStyleLightContent


More information about this key from Apple's Information Property List Key Reference

  • Key: UIStatusBarStyle
  • Xcode name: Status bar style
  • Value: UIStatusBarStyleLightContent = white, UIStatusBarStyleDefault = black
  • Summary: Specifies the style of the status bar as the app launches. See UIStatusBarStyle for details.
Kymer
  • 1,184
  • 8
  • 20
0

Try this

self.navigationController?.navigationBar.barTintColor = UIColor.whiteColor()
Abizern
  • 146,289
  • 39
  • 203
  • 257
UIResponder
  • 785
  • 9
  • 15
0

Set these properties in Info.plist file enter image description here

Add this

UIApplication.sharedApplication().statusBarStyle = UIStatusBarStyle.LightContent

in didFinishLaunchingWithOptions method in AppDelegate

UIResponder
  • 785
  • 9
  • 15
0

One way to do that easily is through the Xcode UI:

Your App -> Targets -> General Tab

For a dark app background. You can use the "Light Content" mode.

enter image description here

guiccbr
  • 650
  • 5
  • 8