Utilizing Xcode 26.0.1 and working on iOS Simulator “iPad (A16)” with iOS 26.0.1.
I’m presenting a view controller as Full Display screen in a navigation controller.
It has a leftBarButtonItem, rightBarButtonItem, and a title.
It additionally has a picture view exhibiting a picture with a white background (the picture isn’t full display).
The leftBarButtonItem’s textual content and background colours appear to robotically alter primarily based on the underlying picture shade and lightweight/darkish mode. The title’s textual content shade, nonetheless, doesn’t and solely makes use of the system textual content shade primarily based on mild/darkish mode.
Right here is how the view controller is offered:
@IBAction func loginPressed(_ sender: Any) {
let lvc = LoginViewController()
lvc.delegate = self
let nc = UINavigationController(rootViewController: lvc)
nc.modalPresentationStyle = .fullScreen
self.current(nc, animated: true)
}
Right here is the viewDidLoad of LoginViewController:
override func viewDidLoad() {
tremendous.viewDidLoad()
self.title = "My Title"
self.view.backgroundColor = .systemBackground
self.navigationItem.leftBarButtonItem = UIBarButtonItem(title: "Assist", type: .plain, goal: nil, motion: nil)
self.navigationItem.rightBarButtonItem = UIBarButtonItem(barButtonSystemItem: .carried out, goal: self, motion: #selector(doneTapped))
let iv = UIImageView()
iv.picture = UIImage(named: "ImageWithWhiteBackground")
iv.contentMode = .scaleAspectFit
iv.translatesAutoresizingMaskIntoConstraints = false
self.view.addSubview(iv)
let wc = NSLayoutConstraint(merchandise: iv, attribute: .width, relatedBy: .equal, toItem: self.view, attribute: .width, multiplier: 1, fixed: 0)
let hc = NSLayoutConstraint(merchandise: iv, attribute: .peak, relatedBy: .equal, toItem: self.view, attribute: .peak, multiplier: 1, fixed: 0)
let xc = NSLayoutConstraint(merchandise: iv, attribute: .centerX, relatedBy: .equal, toItem: self.view, attribute: .centerX, multiplier: 1, fixed: 0)
let yc = NSLayoutConstraint(merchandise: iv, attribute: .centerY, relatedBy: .equal, toItem: self.view, attribute: .centerY, multiplier: 1, fixed: 0)
self.view.addConstraints([wc, hc, xc, yc])
}
That is how the view controller seems in Mild Mode in Portrait and Panorama:
The leftBarButtonItem and title textual content colours are darkish as a result of it is Mild Mode — all the things is seen and readable.
That is how the view controller seems in Darkish Mode in Portrait and Panorama:
The leftBarButtonItem and title textual content colours are mild as a result of it is Darkish Mode — all the things is seen and readable. The picture peak is lower than the display so the view controller’s view (with background shade set to systemBackground) is seen at prime and backside. Discover the leftBarButtonItem is white textual content on a black background (for Darkish Mode).
In panorama, the picture peak is the same as the display so it is white at prime and backside.
Discover the leftBarButtonItem is now black textual content on a white background (although it is Darkish Mode).
However the title remains to be white making it invisible.
A facet situation is the standing bar can be invisible and unreadable.
Is it potential to make the view controller’s title behave just like the leftBarButtonItem in order that it adjustments colours primarily based on the underlying background?
Or, what’s the instructed or really helpful answer for this?
I additionally tried setting self.navigationItem.titleView to a UILabel with “My Title” however that had the identical situation as utilizing self.title.




