NSMenuItemCell
的两个方法 -[NSMenuItemCell menuView]
和 -[NSMenuItemCell setMenuView:]
的 64 位替代是什么类(class)?
我怎样才能获得相同的结果?
最佳答案
NSMenuItemCell
和 NSMenuView
从未在 Mac OS X 的任何发行版本中用于绘制菜单。以下是 Mac OS X 开发人员发行说明的摘录:
Notes specific to MacOS X Developer Preview 3
Menu
The implementation of menus has changed drastically;
NSMenuView
andNSMenuItemCell
are no longer used,-[NSMenu menuRepresentation]
now returnsnil
, and tear off menus are no longer available. For Developer Preview 3, there is no support for menu item images. If there is no text in the menu item, a placeholder text consisting of "< image >" or "< image name >" will be inserted instead. Menu item state images are not supported either and in their place the standard checkbox or dash for on and mixed states are used.
(我不确定预公开测试版 Mac OS X 的确切时间表,但对于“开发者预览版 3”,我猜我们正在谈论 1990 年代末期)。
有关当前如何实现菜单的更多信息,请参阅 Application Menu and Pop-up List Programming Topics: How Menus Work
正如一二三提到的,您使用 NSMenu
和 NSMenuItem
来实现菜单。在 OS X 10.5 及更高版本中,您可以使用 -setView:
方法在 NSMenuItem
中使用自定义 NSView
实例。
关于macos - [NSMenuItemCell menuView] 和 [NSMenuItemCell setMenuView] 的 64 位替换,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7459926/