macos - [NSMenuItemCell menuView] 和 [NSMenuItemCell setMenuView] 的 64 位替换

标签 macos cocoa 64-bit menuitem nsmenuitem

NSMenuItemCell 的两个方法 -[NSMenuItemCell menuView]-[NSMenuItemCell setMenuView:] 的 64 位替代是什么类(class)? 我怎样才能获得相同的结果?

最佳答案

NSMenuItemCellNSMenuView 从未在 Mac OS X 的任何发行版本中用于绘制菜单。以下是 Mac OS X 开发人员发行说明的摘录:

Notes specific to MacOS X Developer Preview 3

Menu

The implementation of menus has changed drastically; NSMenuView and NSMenuItemCell are no longer used, -[NSMenu menuRepresentation] now returns nil, 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

正如一二三提到的,您使用 NSMenuNSMenuItem 来实现菜单。在 OS X 10.5 及更高版本中,您可以使用 -setView: 方法在 NSMenuItem 中使用自定义 NSView 实例。

关于macos - [NSMenuItemCell menuView] 和 [NSMenuItemCell setMenuView] 的 64 位替换,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7459926/

相关文章:

cocoa - WebVIew 问题 HTML5 文档类型

delphi - 如何在 64 位窗口上调整大小时更新表单?

c++ - 改进 InterlockedCompareExchange() 的原子读取

ruby - 为什么重新安装 Ruby 1.8.7 失败

regex - 用一个空行替换两个空行的正则表达式

c - 我应该如何编译这个C代码?

c++ - 使遗留代码 x64 兼容时出现非法读/写错误

objective-c - 避免、发现和消除 Cocoa 中的内存泄漏

ios - insertRowsAtIndexPaths 不工作,崩溃索引超出范围的对象?

objective-c - Objective C 嵌套字典访问无效选择器错误