Search code examples
iosobjective-cuinavigationcontroller

Cannot set prompt color in iOS11


I am trying to set the navbar prompt color in iOS11 to the same color as the navbar title color.

This works just great in iOS10:

[[UINavigationBar appearance] setBarTintColor:[UIColor blueColor]];
[[UINavigationBar appearance] setTitleTextAttributes:@{NSForegroundColorAttributeName: [UIColor whiteColor]}];
[[UINavigationBar appearance] setTranslucent:NO];

enter image description here

However this is no longer working in iOS11. The title is white but the prompt is not.

enter image description here

I found a thread mentioning a hack to try and get the prompt label to change via:

[UILabel appearanceWhenContainedInInstancesOfClasses:@[[UINavigationBar class]]].textColor = [UIColor whiteColor];

However that is not working either.

Anyone else experiencing this?


Solution

  • Seems to be a bug in iOS 11

    Post on the Apple Developer forums:
    https://forums.developer.apple.com/thread/85399

    Radar issue (mirror) 34009213:
    https://github.com/lionheart/openradar-mirror/issues/18233

    It seems to be reported to Apple.