HomeiOS DevelopmentPopovers in iOS 26 show improper system colours and don't change when...

Popovers in iOS 26 show improper system colours and don’t change when person switches gentle/darkish mode


Because the title says, popovers in iOS 26 show improper system colours, and don’t change their colours when person switches gentle/darkish mode. That is in sharp distinction to all earlier programs, equivalent to iOS 18, which behave appropriately. I am very stunned that apparently nobody has pointed this out.

For example the issue, this is an very simple app:

class ViewController: UIViewController {
    @IBAction func doButton(_ sender: UIButton) {
        let popover = ViewController2()
        popover.modalPresentationStyle = .popover
        if let presenter = popover.popoverPresentationController {
            presenter.sourceItem = sender
            presenter.delegate = self
        }
        current(popover, animated: true)
    }
}

extension ViewController: UIPopoverPresentationControllerDelegate {
    func adaptivePresentationStyle(for controller: UIPresentationController) -> UIModalPresentationStyle {
        .none
    }
}

class ViewController2: UIViewController {
    override func viewDidLoad() {
        tremendous.viewDidLoad()
        view.backgroundColor = .systemBackground
        let label = UILabel()
        label.textual content = "Label"
        label.backgroundColor = .systemBackground
        view.addSubview(label)
        label.translatesAutoresizingMaskIntoConstraints = false
        label.centerXAnchor.constraint(equalTo: view.centerXAnchor).isActive = true
        label.centerYAnchor.constraint(equalTo: view.centerYAnchor).isActive = true
    }
}

Run the app and faucet the button to show the popover. The label within the popover appears like this:

Popovers in iOS 26 show improper system colours and don’t change when person switches gentle/darkish mode

Effectively, that is simply improper. The label’s background colour is .systemBackground, and the colour of the popover view behind the label is .systemBackground; they need to each the be similar, i.e. basically white, after we are in gentle mode. As an alternative, the label background seems basically black.

(Please notice that .systemBackground is just not the one colour that shows this challenge; you possibly can see it with any dynamic colour that has .system in its identify.)

Furthermore, now with the popover exhibiting, swap your machine / simulator from gentle mode to darkish mode. I anticipate the entire background of the popover to develop into darkish. It does not change in any respect! However when you dismiss the popover and present it once more, it is darkish. So it is aware of the present gentle/darkish mode on the time it seems, however it’s unresponsive to adjustments in gentle/darkish mode.

Certainly, if we name registerForTraitChanges([UITraitUserInterfaceStyle.self]) within the popover’s viewDidLoad, we’ll discover that our motion methodology isn’t known as. The popover is just not receiving gentle/darkish mode trait change info!

How are folks coping with this challenge?

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

- Advertisment -
Google search engine

Most Popular

Recent Comments