Posts

Post not yet marked as solved
1 Replies
256 Views
Hi! I'm moving my UINavigationBar and UINavigationItem to the iOS 16 style and having trouble with disabling buttons. Before: I'm defining rightBarButtonItems with a few barButtonItems plus a (custom) menuButtonItem (which has a menu with some more actions). After: I'm defining trailingItemGroups and let the system create an overflow menu dynamically, depending on space. I'm also defining some additionalOverflowItems. Here's the problem: How can I access the button/barButtonItem that is showing the overflow menu and call isEnabled = false? My UI, so far, has disabled all buttons during edit mode. I don't want to hide them, but have them grayed out, including the overflow menu button. class MyVC : UIViewController { // ... override func setEditing(_ editing: Bool, animated: Bool) {         super.setEditing(editing, animated: animated) // ... // This doesn't disable the overflow menu button         navigationItem .trailingItemGroups .forEach { $0.barButtonItems .forEach { $0.isEnabled = !isEditing } }     } }
Posted Last updated
.