1

I was looking at this post: Gap above NSMenuItem custom view and this seems to be not working in Mac OS X 10.10.

I have a custom MenuItem and MenuItemView classes and prior to 10.10, they are working fine. Now, I can see the gray-colored gap at the top and bottom of the menuitem view. Only seen in Mac OS X 10.10. Is this a Yosemite issue or do I need to handle this?

Any help is much appreciated. Thanks.

Community
  • 1
  • 1
jtubog
  • 23
  • 3

1 Answers1

1

If you aren't targeting Mac App Store, here's a workaround using a private API for turning the top padding off.

First, declare the following category on NSMenu (otherwise you'll get lots of ARC unknown-selector-errors):

@interface NSMenu (Private)
// Use NSMaxYEdge to toggle the top padding
// and NSMinYEdge to toggle the bottom one
- (void)_setHasPadding: (BOOL)enabled onEdge: (NSRectEdge) edge;
@end

Then use it as follows:

[self.menu _setHasPadding: NO onEdge: NSMaxYEdge];
Dmitry Rodionov
  • 336
  • 3
  • 6
  • thanks. i can use this for now until such time I can figure out how to do this the proper way. But thanks for your response. – jtubog Feb 02 '15 at 07:36
  • @jtubog I also encourage you to duplicate [the radar I filed about this issue](http://www.openradar.me/19661956). – Dmitry Rodionov Feb 02 '15 at 12:51