Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Color text of status bar in XCode 6-b3 (Swift)

Tags:

swift

xcode6

I've try to modify status bar color text but no one answer from this thread doesn't work. Any especially for XCode 6?

I've tried insert:

override func preferredStatusBarStyle() -> UIStatusBarStyle {
    return UIStatusBarStyle.LightContent
}

to UIViewController

also

UIApplication.sharedApplication().setStatusBarStyle(UIStatusBarStyle.LightContent, animated: true)

to AppDelegate.swift And I've tried change it in info.plist But it doesn't affect it. How change status bar color text to white?

like image 280
Max Avatar asked Jul 14 '14 21:07

Max


People also ask

How do I change the color of a status bar in Swift?

Open your info. plist and set UIViewControllerBasedStatusBarAppearance to false . In the first function in AppDelegate. swift , which contains didFinishLaunchingWithOptions , set the color you want.

How do I change the color of my text bar in swift 5?

Go to Project -> Target , Then set Status Bar Style to Light . It makes status-bar white from the launch screen. Then set View controller-based status bar appearance equal to NO in Info.

How do you make a status bar light in Swift?

Open you Info. Add View controller-based status bar appearance key ( UIViewControllerBasedStatusBarAppearance ) and set value to No ( false ). Add Status bar style key ( UIStatusBarStyle ) and set value to Light Content ( UIStatusBarStyleLightContent ).


1 Answers

In your Info.plist you need to define View controller-based status bar appearance to any value.

enter image description here

If you define it YES then you should override preferredStatusBarStyle function in each view controller.

If you define it NO then you can set style in AppDelegate using

UIApplication.sharedApplication().statusBarStyle = .LightContent

like image 113
Keenle Avatar answered Oct 18 '22 11:10

Keenle