Chapter 25. Updating Menus
In many applications, it is necessary to enable and disable menu items as the user interacts with the application. In particular, as the first responder changes, a menu item that is nil-targeted will need to be disabled if the responder chain does not respond to its action. By default, this activity is handled for you. When displaying itself, the menu item will automatically figure out if the current target has the appropriate action. If it does not, the menu item will be disabled.
When a menu item is deciding whether it should be enabled, it will ask its target if it implements validateMenuItem:. If so, the target is sent validateMenuItem:. If the target returns YES, the menu item is enabled.
To enable and disable menu ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access