将新的主菜单对象添加到 Xcode 4 中的项目
如果我出于某种原因删除 MainMenu.xib 中的主菜单对象,是否可以重新创建它?
我尝试添加菜单对象,但不幸的是我无法将其设为主菜单。意思是,它就在那里,我可以添加菜单项,但只能在一列中添加,并且我无法添加其他菜单 - 列。它也不会出现在 IB 窗口的上方......
有人知道吗?
我安装了 Xcode 4.2、Lion 10.7.2。
If I delete Main Menu object in MainMenu.xib for whatever reason, is it possible to recreate it?
I have tried to add Menu object, but unfortunately I cannot make it main menu. Meaning, it is there, I can add menu items, but only in one column and I cannot add other Menus - columns. It doesn't appear visually above in the IB window as well....
Anybody knows?
I have Xcode 4.2, Lion 10.7.2 installed.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
如果找到 XCode 6.2 的解决方案:
systemMenu="main"
属性。您的 XML 应该类似于If found a solution for XCode 6.2:
systemMenu="main"
property. Your XML should look like我也想不通这一点。我删除了菜单栏以制作仅菜单栏的应用程序,但事实证明您需要有一个(不可见的)菜单栏才能使用任何键盘快捷键。所以我必须找回菜单栏。
我最终创建了一个新的 Xcode 项目,选择其中的(自动创建的)菜单栏,复制它,并将其粘贴到我的原始项目中。
您必须清理一些东西,但您可以粘贴菜单栏。这是我能把它拿回来的唯一方法。
注意:这可能会破坏菜单栏项目及其操作之间的连接。我不得不重新连接“编辑”>例如,将菜单项复制到应用程序代理的“复制”操作。
I couldn't figure this out either. I deleted the menubar to make a menubar-only app, but it turns out you need to have an (invisible) menubar to use any keyboard shortcuts. So I had to get the menubar back.
I ended up creating a new Xcode project, selecting the (automatically created) menubar there, copying it, and pasting it into my original project.
You have to clean up a few things, but you are able to paste the menubar. That's the only way I could get it back.
NOTE: This may break the connections between the menubar items and their actions. I had to go re-hook-up the Edit > Copy menu item, for example, to the App Delegate's "Copy" action.
我也遇到了同样的问题。我的解决方案是告诉 XCode 在我的项目 Info.plist 中加载哪个 nib 文件作为基本 nib。因此,只需创建一个新的 Menu.xib 并将 info.plist 中的“主 nib 文件基本名称”属性更改为 Menu.xib 文件的名称。因此,如果您的 Menu.xib 文件名为“mainMenu.xib”,请将“主 nib 文件基本名称”属性更改为“mainMenu”。
I had the very same problem. The solution for me was to tell XCode inside my projects Info.plist which nib file to load as the base nib. So just create a new Menu.xib and change the 'Main nib file base name' property inside the info.plist to the name of your Menu.xib file. So if your Menu.xib files name is 'mainMenu.xib', change 'Main nib file base name' property to 'mainMenu'.