Last active
April 8, 2016 01:52
-
-
Save ccabanero/7944453 to your computer and use it in GitHub Desktop.
iOS - Making the status bar text white in iOS 7
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1. In the project's info.plist. Add the key 'View controller-based status bar appearanced' with the value 'NO'. | |
2. In the Application Delegate's 'didFinishLaunching' add | |
[[UIApplication sharedApplication] setStatusBarStyle:UIStatusBarStyleLightContent]; | |
Code snippet ... | |
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions | |
{ | |
self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]]; | |
//navigation bar appearance across app | |
[[UINavigationBar appearance] setBarTintColor: [UIColor colorWithRed:129/255.0 green:200/255.0 blue:244/255.0 alpha:1.0]]; | |
[[UINavigationBar appearance] setTintColor:[UIColor whiteColor]]; | |
//set status bar text style | |
[[UIApplication sharedApplication] setStatusBarStyle:UIStatusBarStyleLightContent]; | |
ViewController *viewController = [[ViewController alloc] initWithNibName:@"ViewController" bundle:nil]; | |
viewController.title = @"Observations"; | |
UINavigationController *navigationController = [[UINavigationController alloc] initWithRootViewController:viewController]; | |
[navigationController.navigationBar setTranslucent:YES]; | |
//set navigation bar text color as white | |
navigationController.navigationBar.titleTextAttributes = @{NSForegroundColorAttributeName : [UIColor whiteColor]}; | |
[self.window setRootViewController:navigationController]; | |
self.window.backgroundColor = [UIColor whiteColor]; | |
[self.window makeKeyAndVisible]; | |
return YES; | |
} | |
-------------------- | |
OR WITH NO CODE ... | |
In plist | |
1. Status bar is initiallhidden | Boolean | NO | |
2. Status bar style | String | UIStatusBarStyleLightContent | |
3. View controller-based status bar appearance | Boolean | NO | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
๐