NSMenuItem NSView does not stand out in the submenu

I have an NSStatusItem that displays NSMenu , full of NSView subclasses. I override drawRect: in my subclass of NSView to implement selection in NSMenu , and everything works fine in the root menu, but for some reason it doesn't work in the submenu of the root menu. I put several NSLog statements in subclasses of NSView drawRect: and noticed that it wasn’t even called for views in the submenu. Any ideas?

I can publish the code that I use to highlight the views, but I do not think it is necessary, since drawRect: is not even called. Let me know if there is any other code you need so that this can help.

+6
source share
2 answers

The problem seems to have been resolved itself. Perhaps I just forgot to set the view to use my subclass of NSView .

0
source

Can you use the NSMenuItem setEnabled method to sort jog routines that come to life?

0
source

Source: https://habr.com/ru/post/889858/


All Articles