问题描述
在TextEdit中,如果您单击文件名旁边的小下拉菜单,您会看到一个菜单,其中显示了一些条目,包括重命名
, iCloud
,移至
,重复
,锁定
,最后浏览所有版本
。
In TextEdit, if you click the little dropdown next to the filename you get a menu which shows a couple of entries including Rename
, Move to iCloud
, Move To
, Duplicate
, Lock
and finally Browse All Versions
.
我想知道如何支持这个菜单?在我的应用程序我有披露指示,但没有菜单,我点击它。我需要通过代码添加此菜单吗?如果是这样,我假设我需要链接到窗口不知何故,但我没有看到一个合适的地方这样做。关于我缺少什么建议?
I'm wondering how to support this menu? On my app I have the disclosure indictor, but get no menu which I click it. Do I need to add this menu via code? If so, i'm assuming I need to link it to the window somehow, but I don't see a proper place to do so. Any suggestions on what i'm missing?
推荐答案
想象出来。我正在重写:
Figured it out. I was overriding:
- (void)menuNeedsUpdate:(NSMenu *)menu
我不需要重写这个方法,所以我删除它。一旦我这样做,我的菜单就开始工作了。
I didn't need to be overriding this method, so I removed it. As soon as I did that, my menu started working.
这篇关于Cocoa - 添加菜单以支持版本? (像在TextEdit中)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!