Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to hide a NSMenuItem?

I'm currently writing a Mac App in Objective-C and can't for the life of me figure out how to hide a NSMenuItem. (Note: Yes I really mean hide, not disable/grey-out. I realize the UX implications of doing so, but the functionality isn't really what you think it is. Just trust me on this.)

The documentation doesn't mention anyway to do so, is it even possible?

like image 927
John Moss Avatar asked Dec 28 '22 16:12

John Moss


1 Answers

If you have defined your NSMenuItem in your header and connected it through your NIB, you can simply call the Hidden property.

[myMenuItem setHidden:YES];

"Greying out" the menuItem would be [myMenuItem setEnabled: NO];

like image 117
WrightsCS Avatar answered Dec 31 '22 15:12

WrightsCS