.hidden not working when making UIBarButtonItem visibles on iOS 26

Hi, I have a UIToolbar at the bottom of my screen. The UIToolbar is made of UIBarButtonItems. At some point, I change the status of some buttons to hidden:

button.isHidden = true

This works: the buttons become invisible. At a later point in the process, I turn the buttons visible again:

button.isHidden = false

This did work on iOS 18, and does not work with the iOS 26 SDK: the buttons remain hidden, even though the property has been set to false.

Am I doing it wrong? Is there anything I can do to fix this?

Thank you for sharing your post. Could you please provide a focus project that I can utilize to test your implementation? Could you please provide all the versions of your environment, including Xcode, macOS, and iOS target?

If so, please share a link to your test project. That'll help us better understand what's going on. If you're not familiar with preparing a test project, take a look at Creating a test project.

Albert Pascual
  Worldwide Developer Relations.

Thank you for your reply.

Here is a test project that demonstrates what happens: https://filesender.renater.fr/?s=download&token=2148c569-5b67-4977-9404-1e09478b0ff8

I am running:

  • Xcode 26.0.1 (17A400)
  • macOS Tahoe 26.0 on a 13 inch 2020 MacBook Pro (Intel).
  • iOS 26.0.1 on an iPhone SE

In case other developers encounter the same issue, I found out by accident that I can force the toolbar to check the status of its buttons by adding an extra button, then removing it:

if #available(iOS 26, *) {
    self.editorToolbar.items?.append(UIBarButtonItem(title: "Hi", style: .plain, target: self, action: nil))
    self.editorToolbar.items?.removeLast()
}

With this change, the buttons that were hidden become apparent again. Now I have the issue that the longPressGesture is not called on the buttons that were temporarily hidden...

.hidden not working when making UIBarButtonItem visibles on iOS 26
 
 
Q