Create an account

Very important

  • To access the important data of the forums, you must be active in each forum and especially in the leaks and database leaks section, send data and after sending the data and activity, data and important content will be opened and visible for you.
  • You will only see chat messages from people who are at or below your level.
  • More than 500,000 database leaks and millions of account leaks are waiting for you, so access and view with more activity.
  • Many important data are inactive and inaccessible for you, so open them with activity. (This will be done automatically)


Thread Rating:
  • 314 Vote(s) - 3.5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How to change Status Bar text color in iOS

#21
In Plist, add this:

- Status bar style: `UIStatusBarStyleLightContent`
- View controller-based status bar appearance: `NO`
Reply

#22
I'm using [Xcode][1] 6 beta 5 on a [Swift][2] project, for an iOS 7 app.

Here is what I did, and it works:

info.plist:

![Enter image description here][3]

[1]:

[To see links please register here]

[2]:

[To see links please register here]

[3]:

Reply

#23
For [Xcode][1] 5.1:

Add "**View controller-based status bar appearance**" to **NO** in the .plist.

In AppDelegate, add:

[[UIApplication sharedApplication] setStatusBarStyle:UIStatusBarStyleLightContent];

That's all!

[1]:

[To see links please register here]

Reply

#24
Answer updated for for Xcode GM Seed:

1. In `Info.plist` put `View controller-based status bar appearance` as `NO`


2. In the project, set:

![Enter image description here][1]


3. In ViewDidLoad:

`[[UIApplication sharedApplication] setStatusBarStyle:UIStatusBarStyleLightContent];`

[1]:

Reply

#25
in info.plist set the field value NO **View controller-based status bar appearance** and set **statusbar** style light in target > general setting.
Reply

#26
This is documented in the [iOS 7 UI Transition Guide][1], which you need an Apple developer ID to access directly. The relevant excerpt:

> Because the status bar is transparent, the view behind it shows through. [...] Use a `UIStatusBarStyle` constant to specify whether the statusbar content should be dark or light:
>
> `UIStatusBarStyleDefault` displays dark content. [...]
>
> `UIStatusBarStyleLightContent` displays light content. Use when dark content is behind the status bar.

Also possibly of interest:

> In iOS 7, you can control the style of the status bar from an individual vew controller and change it while the app runs. To opt in to this behavior, add the `UIViewControllerBasedStatusBarAppearance` key to an app's `Info.plist` file and give it the value `YES`.

I'd definitely recommend having a look through the document, which, again, you can access with your Apple developer ID.

[1]:

[To see links please register here]

Reply

#27


Let me give you a complete answer to your question. Changing the status bar text color is very easy but its a little confusing in iOS 7 specially for newbies.

If you are trying to change the color from black to white in Storyboard by selecting the view controller and going to Simulated Metrics on the right side, it won't work and i don't know why. It should work by changing like this but any how.

Secondly, you won't find UIViewControllerBasedStatusBarAppearance property in your plist but by default its not there. You have to add it by yourself by clicking on the + button and then set it to NO.

ios 7 status bar text color

Lastly, you have to go to your AppDelegate.m file and add the following in didFinishLaunchingWithOptions method, add the following line:

[[UIApplication sharedApplication] setStatusBarStyle:UIStatusBarStyleLightContent];

This will change the color to white for all your view controllers. Hope this helps!
Reply

#28
I think all the answers do not really point the problem because all of them work in specific scenarios. But if you need to cover all the cases follow the points bellow:

Depending on where you need the status bar light style you should always have in mind these 3 points:

**1)If you need the status bar at the launch screen or in other places, where you can't control it (not in view controllers, but rather some system controlled elements/moments like Launch Screen)**
You go to your project settings
[![Project settings][1]][1]


**2) if you have a controller inside a navigation controller**
You can change it in the interface builder as follows:

a) Select the navigation bar of your navigation controller
[![Select the navigation bar of your navigation controller][2]][2]


b) Then set the style of the navigation bar to "Black", because this means you'll have a "black" -> dark background under your status bar, so it will set the status bar to white

[![enter image description here][3]][3]

Or do it in code as follows

navigationController?.navigationBar.barStyle = UIBarStyle.Black

**3) If you have the controller alone that needs to have it's own status bar style and it's not embedded in some container structure as a UINavigationController**

Set the status bar style in code for the controller:

[![Setting the status bar style in code][4]][4]


[1]:

[2]:

[3]:

[4]:
Reply

#29
If you want to set it to any color, use below code.

id statusBarWindow = [[UIApplication sharedApplication] valueForKey:@"statusBarWindow"];
id statusBar = [statusBarWindow valueForKey:@"statusBar"];

SEL setForegroundColor_sel = NSSelectorFromString(@"setForegroundColor:");
if([statusBar respondsToSelector:setForegroundColor_sel]) {
// iOS 7+
[statusBar performSelector:setForegroundColor_sel withObject:YourColorHere];
^^^^^^^^^^^^^
}

***I know I am accessing private API, but I have used this in many projects and Apple have approved it.***

*Just while submitting the app, send this code to Apple in Comments section and inform that you are using this code to change the status bar color.*

***And yes***, *don't forget below too.*

![](
)
Reply

#30
I make this in iOS 9 and Swift 2.0 if I use UINavigationController

self.navigationController?.navigationBar.barStyle = UIBarStyle.Black
And I make this if I use modal segue

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



Forum Jump:


Users browsing this thread:
1 Guest(s)

©0Day  2016 - 2023 | All Rights Reserved.  Made with    for the community. Connected through