iOS 11 set UINavigationBar.tintColor ignored, if already set UIButton.appearance().tintColor

Originator:blesserx
Number:rdar://34616451 Date Originated:2017/09/25
Status:Duplicate/33231933 Resolved:
Product:iOS + SDK Product Version:iOS 11
Classification:UIKit Reproducible:Always
 
Area:
UIKit

Summary:
UIBarButtonItem's color is controlled by UINavigationBar.tintColor. In iOS 11 if UIButton.appearance().tintColor is set, UINavigationBar.tintColor setter will be ignored.

Steps to Reproduce:
1. UIButton.appearance().tintColor = .orange

2a. UINavigationBar.appearance().tintColor = .red
OR
2b. navigationController?.navigationBar.tintColor = .green

Expected Results:
Case 2a. barButtonItems' color should be red.
Case 2b. barButtonItems' color should be green.

Actual Results:
Case 2a. barButtonItems' color is orange.
Case 2b. barButtonItems' color is orange.

Version/Build:
iOS 11.0(15A372) on iPhone 7 Plus and Simulators.

Configuration:
Xcode 9.0(9A235)

Discuss:
UIButton.appearance() is a subset of UIView.appearance(). Which means setting up app global tintColor with UIView.appearance().tintColor also "lock" navigationBar.tintColor.

Please see sample project.

Comments


Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!