本文介绍了从菜单中删除“开始听写”和“特殊字符”的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

要在我的Cocoa应用程序中启用复制和粘贴,我向菜单添加了两个新菜单项(复制和粘贴),并将选择器从每个项目拖到第一个响应者(复制和粘贴)。但是,复制和粘贴菜单项下面会显示两个额外的项目:开始听写和特殊字符。

To enable Copy and Paste in my Cocoa app, I added two new menu items (copy and paste) to the menu and dragged the selector from each item to the first responder (copy and paste). However, two extra items show up below the Copy and Paste menu items: 'Start Dictation' and 'Special Characters' .

我无法弄清楚它们为什么出现或如何删除它们。

I haven't been able to figure out why they show up or how I remove them.

,我什至不希望复制和粘贴菜单项可见。我只希望我的应用程序的用户能够将东西(例如,来自电子邮件,文本文档等)粘贴到我的应用程序之一的文本字段中。

Optimally, I don't even want the copy and paste menu items to be visible. I just want the user of my app to be able to paste stuff (i.e. from an email, text doc etc) into a text field on one of the forms in my app.

推荐答案

和,您可以在加载笔尖之前在main()中执行类似操作(但不支持该API):

As mentioned in Mac OS X Internals: A Systems Approach and Qt Mac (Re)move "Special Characters..." action in Edit menu, you can do something like this in main() before you load the nib (but it is not supported API):

[[NSUserDefaults standardUserDefaults] setBool:YES forKey:@"NSDisabledDictationMenuItem"];
[[NSUserDefaults standardUserDefaults] setBool:YES forKey:@"NSDisabledCharacterPaletteMenuItem"];

这篇关于从菜单中删除“开始听写”和“特殊字符”的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-02 05:54