I have a reference to the outermost menu, but I’m trying to get a reference to an NSMenuItem that’s nested in a submenu:
NSMenuItem* file_menu = [menu itemWithTitle:@"File];
file_menu is obviously a submenu (NSMenu), but I’m not sure how to get an item out of it’s itemarray. I’ve tried casting it to an NSMenu and performing itemWithTitle as a selector with no luck.
How can I get the first NSMenuItem out of it?
Like this.
If the menu item has a sub menu the submenu property will let you access it, you can then access its menu items using the itemArray property.