I've inherited a legacy app and was tasked with updating it for iOS 11. In one view, the user can click on a name and add that user to their contacts. However, when going to the 'add contact' view in iOS 11, the navigation and status bars are showing up as white. It works fine on iOS 10 and below.
Here's a screenshot comparing iOS 10 (left) to iOS 11 (right):
Note that this view is created programmatically, and not through the storyboard:
ABRecordRef person = ABPersonCreate();
//...
ABNewPersonViewController *newPersonViewController = [[ABNewPersonViewController alloc] init];
[newPersonViewController setDisplayedPerson:person];
newPersonViewController.newPersonViewDelegate = self;
UINavigationController *newNavigationController = [[UINavigationController alloc] initWithRootViewController:newPersonViewController];
[self presentViewController:newNavigationController animated:YES completion:nil];
CFRelease(person);
I've tried a few different things based on what I found online:
Any advice would be helpful.
Edit: The Navigation bar colors get set in the AppDelegate in the didFinishLaunchingWithOptions method as seen below. I tried removing all the custom logic that gets set here. This somewhat fixed the navigation bar, but the status bar was still white with white text.
-(BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
// Override point for customization after application launch.
if ([MPUtils isIOS7OrHigher]) {
[[UIToolbar appearance] setBarTintColor:[MPColors colorWithColorString:MPColorString0A3B77]];
[[UINavigationBar appearance] setBarTintColor:[MPColors colorWithColorString:MPColorString0A3B77]];
//color of text on buttons:
[[UINavigationBar appearance] setTintColor:[UIColor whiteColor]];
[[UINavigationBar appearance] setTitleTextAttributes:@{UITextAttributeTextColor : [UIColor whiteColor]}];
} else {
[[UIToolbar appearance] setTintColor:[MPColors colorWithColorString:MPColorString0A3B77]];
[[UINavigationBar appearance] setTintColor:[MPColors colorWithColorString:MPColorString0A3B77]];
}
[[UIApplication sharedApplication] setStatusBarStyle:UIStatusBarStyleLightContent];
[MPUserDataSynchronizer syncUserData];
return YES;
}
I also faced this kind of issue and i solved this by doing this.
[[UINavigationBar appearance] setTranslucent:NO];
[[UINavigationBar appearance] setBarTintColor: [UIColor redColor]];
[[[[UIApplication sharedApplication] delegate] window] setBackgroundColor:[UIColor redColor]];
Hope this will help someone and save a lot of time :).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With