I have a storyboard-app with several viewControllers and a tabBarController. Up to now the color of the title of the navigationBar was white. Now I'm testing with Xcode 11 beta 6 an iOS 13 beta 8 and the title are black. On devices with iOS 12 the title are still white. I tried to set title color in the navigation bar of the navigation controller in the storyboard. But this makes no difference. I also tried to change the title color in every view, but sometimes it doesn't work. At the beginning of testing with iOS 13 I had to change my code for changing the backgroundcolor of the statusbar. The code is this:
self.tabBarController.title = NSLocalizedString(@"AppTitle",nil);
NSShadow *shadow = [[NSShadow alloc] init];
shadow.shadowColor = [UIColor clearColor];
shadow.shadowOffset = CGSizeMake(0, 1);
[self.navigationController.navigationBar setBarTintColor:COLOR_HEADER_LIGHT];
if (@available(iOS 13, *))
{
UINavigationBarAppearance *navBar = [[UINavigationBarAppearance alloc] init];
navBar.backgroundColor = COLOR_HEADER_LIGHT;
self.navigationController.navigationBar.standardAppearance = navBar;
self.navigationController.navigationBar.scrollEdgeAppearance = navBar;
}
else
{
UIView *statusBar = [[[UIApplication sharedApplication] valueForKey:@"statusBarWindow"] valueForKey:@"statusBar"];
if ([statusBar respondsToSelector:@selector(setBackgroundColor:)]) {
statusBar.backgroundColor = COLOR_HEADER_LIGHT;
}
}
[self.navigationController.navigationBar setTitleTextAttributes:[NSDictionary dictionaryWithObjectsAndKeys:
shadow, NSShadowAttributeName, FONT_MEDIUM_SIZE_18, NSFontAttributeName,
COLOR_TEXT_WHITE, NSForegroundColorAttributeName, nil]];
[self.navigationController.navigationBar setTintColor:COLOR_TEXT_WHITE];
I hope anyone has an idea how to change the title color back to white. Best case without adjust every controller.
In iOS13 you need to set the title color on the UINavigationBarAppearance object - try adding this line to your code:
appearance.titleTextAttributes = [.foregroundColor: myAppLabelColor]
appearance.largeTitleTextAttributes = [.foregroundColor: myAppLabelColor]