When using a custom UIButton as the customView for a UIBarButtonItem in iOS 26, setting the tintColor on the UIBarButtonItem or the button itself does not affect the button’s appearance in the navigation bar. The button displays, but the tint is not applied as expected.
Steps to Reproduce:
- Create a new iOS project with a navigation controller.
- Use the following code in your view controller:
class ViewController: UIViewController {
override func viewDidLoad() {
super.viewDidLoad()
view.backgroundColor = .secondarySystemBackground
var configuration = UIButton.Configuration.plain()
configuration.title = "Why Not Tinted...?"
configuration.baseForegroundColor = .systemBlue
configuration.contentInsets = NSDirectionalEdgeInsets(top: 12, leading: 12, bottom: 12, trailing: 12)
let button = UIButton(configuration: configuration)
let rightBarButton = UIBarButtonItem(customView: button)
rightBarButton.tintColor = .green
navigationItem.rightBarButtonItem = rightBarButton
}
}
Expected Result: The UIButton in the navigation bar should appear green with glass effect, according to the tintColor set on the UIBarButtonItem.
Actual Result: The UIButton appears, but the tintColor is not applied. Changing the tintColor on either the UIBarButtonItem or the UIButton has no effect on its appearance in the navigation bar.