Cómo crear un NSMenuItem personalizado

Well, I have quite a basic question which I can't seem to find an answer to. I followed this guide to create a StatusBar menu, which works great... However, I would like to add a custom NSMenuItem containing custom stuff. As example such as the sound slider, or the switch user account row ect.

¿Cómo puedo hacer eso?

Even links to tutorials are welcome.

preguntado el 09 de marzo de 12 a las 14:03

2 Respuestas

In most cases, you'll create a custom view containing the slider or whatever else you want to appear in the menu item. Then you call setView: al NSMenuItem en cuestión.

For more details, check this article from Apple's documentation: https://developer.apple.com/library/mac/#documentation/Cocoa/Conceptual/MenuList/Articles/ViewsInMenuItems.html

respondido 09 mar '12, 14:03

Solo usa el setView: método de NSMenuItem.

respondido 09 mar '12, 14:03

Hi, is it possible that you can show an example as well? This is more of a helpful comment to the question than an actual answer. Thank you! :) - jmort253

No es la respuesta que estás buscando? Examinar otras preguntas etiquetadas or haz tu propia pregunta.