I have an IBOutlet that I have linked to from the storyboard
@IBOutlet var creeLigueBouton: UIBarButtonItem!
and I want to make it disappea
First way:
Just set .title to ""
Second way:
Just call updateToolBar() whenever you want to show/hide the creeLigueBouton.
func updateToolBar() {
var barItems: [UIBarButtonItem] = []
if condition != true {
// Make it appear
barItems.append(creeLigueBouton)
}
barItems.append(anotherButton)
myToolBar.setItems(barItems, animated: true)
myToolBar.setNeedsLayout()
}