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

#11
iOS 7 allows individual view controllers to determine the appearance of the status bar, as described by the Apple developer documentation:

> iOS 7 gives view controllers the ability to adjust the style of the status bar while the app is running. A good way to change the status bar style dynamically is to implement `preferredStatusBarStyle` and—within an animation block—update the status bar appearance and call `setNeedsStatusBarAppearanceUpdate`.

Setting the status bar appearance globally is a two-step process.

First, you need to tell iOS that you don't want to set the status bar appearance on a view-by-view basis.

Then you need to take charge and actually set the new global status bar style.

To disable view-by-view status bar control, you'll need to set the `View controller-based status bar appearance` property in `Info.plist`.

Open the Project Navigator and select the project for your iOS app, then select the Info tab.

Hover over a row, then click the plus sign that appears to add a new property to your `.plist`.

Enter `View controller-based status bar appearance` in the Key field, then make sure the Type field is set to `Boolean`. Finally, enter `NO` in the Value field.

To set a global style for the status bar, add another property under the Info tab with a key of `Status bar style`, a Type of `String` and a Value of `Opaque black style`.

Here's a blog post with a little more detail and some sample code:

[To see links please register here]

Reply

#12
This worked for me:

1. Set the `UIViewControllerBasedStatusBarAppearance` to `YES` in the `plist`

2. The `rootViewController` needs the method implementation for

-(UIStatusBarStyle)preferredStatusBarStyle

Because my `rootViewController` is managed by Cocoapods (`JASidePanelController`) I added this method through a category:

#import "JASidePanelController+StatusBarStyle.h"

@implementation JASidePanelController (StatusBarStyle)

- (UIStatusBarStyle)preferredStatusBarStyle
{
return UIStatusBarStyleLightContent;
}

@end

Reply

#13
Just two steps as following:

**Step 1:**

Under the Info tab of the `project target`, Add Row:

`UIViewControllerBasedStatusBarAppearance`, set value `NO`.


**Step 2:**

In the project `AppDelegate.m`:

- (BOOL)application:(UIApplication *)application
didFinishLaunchingWithOptions:(NSDictionary *)launchOptions{

[application setStatusBarStyle:UIStatusBarStyleLightContent];

}
Reply

#14
Simply calling

[[UINavigationBar appearance] setBarStyle:UIBarStyleBlack];

in the

-(BOOL)application:(UIApplication *)application
didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
}

method of my `AppDelegate` works great for me in iOS7.
Reply

#15
Just to summarize, edit your project `Info.plist` and add:

`View controller-based status bar appearance` : `NO`

`Status bar style` : `Opaque black style`

or if you have raw key/value plist

`UIViewControllerBasedStatusBarAppearance` : `NO`

`UIStatusBarStyle` : `Opaque black style`
Reply

#16
In AppDelegate.m, add the following.

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions{

[[UIApplication sharedApplication] setStatusBarStyle:UIStatusBarStyleLightContent];

}

And in the Plist file, set 'View controller-based status bar appearance' to NO.
Reply

#17
On iOS 7, if you want to use UIViewControllerBasedStatusBarAppearance == YES, and your root view controller is UINavigationController, you should
subclass it and overload childViewControllerForStatusBarStyle, for example, like this:

- (UIViewController*) childViewControllerForStatusBarStyle
{
return self.viewControllers.lastObject;
}

After this, preferredStatusBarStyle will be called on pushed view controllers.
Reply

#18
You can use this for iOS 6 and 7:

#ifdef __IPHONE_7_0
# define STATUS_STYLE UIStatusBarStyleLightContent
#else
# define STATUS_STYLE UIStatusBarStyleBlackTranslucent
#endif

[[UIApplication sharedApplication] setStatusBarStyle:STATUS_STYLE animated:YES];
Reply

#19
None of that worked for me, so here is a working solution...

In `Info.plist`, add a row:

`UIViewControllerBasedStatusBarAppearance`, and set the value `NO`.

Then in AppDelegate in `didFinishLaunchingWithOptions`, add these rows:

[application setStatusBarHidden:NO];
[application setStatusBarStyle:UIStatusBarStyleLightContent];
Reply

#20
Well, this is really working like a piece of cake for me.

Go to your app's `info.plist`.

1. Set `View controller-based status bar appearance` to `NO`
2. Set `Status bar style` to `UIStatusBarStyleLightContent`

Then go to your app's delegate and paste in the following code where you set your windows's RootViewController.

#define SYSTEM_VERSION_GREATER_THAN_OR_EQUAL_TO(v) ([[[UIDevice currentDevice] systemVersion] compare:v options:NSNumericSearch] != NSOrderedAscending)

if (SYSTEM_VERSION_GREATER_THAN_OR_EQUAL_TO(@"7.0"))
{
UIView *view=[[UIView alloc] initWithFrame:CGRectMake(0, 0,320, 20)];
view.backgroundColor=[UIColor colorWithRed:0/255.0 green:0/255.0 blue:0/255.0 alpha:1.0];
[self.window.rootViewController.view addSubview:view];
}

Bingo. It's working for me.
Reply



Forum Jump:


Users browsing this thread:
1 Guest(s)

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