Xcode 4 为什么我在单击 MainStoryBoard.storyboard 时会看到 XML:似乎是一个错误

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/9465361/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-14 23:27:38  来源:igfitidea点击:

Xcode 4 why do I see XML when clicking on MainStoryBoard.storyboard: seems like a bug

iosxcode

提问by user310291

In an Xcode project, I see XML when clicking on MainStoryBoard.storyboard instead of the graphical design, why and how to restore the right view ?

在 Xcode 项目中,我在单击 MainStoryBoard.storyboard 时看到 XML 而不是图形设计,为什么以及如何恢复正确的视图?

Update: I think it's a bug of XCode 4.2 because on another project, when I click on version editor I have XML but when I click on standard editor it shows visual design.

更新:我认为这是 XCode 4.2 的一个错误,因为在另一个项目中,当我点击版本编辑器时,我有 XML,但是当我点击标准编辑器时,它显示了视觉设计。

Is there a way to fix this and not to force me to recreate my visual design by hand once again ?

有没有办法解决这个问题,而不是强迫我再次手工重新创建我的视觉设计?

回答by Jonathan

To fix the issue, right-click MainStoryboard.storyboard, then choose "Open as >" and then "Interface Builder - iOS Storyboard".

要解决此问题,请右键单击 MainStoryboard.storyboard,然后选择“Open as >”,然后选择“Interface Builder - iOS Storyboard”。

回答by Besi

Make sure you are not using the source control editor, which shows you the changes for a given file. You can change this in the Toolbar at the top right.

确保您没有使用源代码控制编辑器,它会显示给定文件的更改。您可以在右上角的工具栏中更改此设置。

Check this linkin the section "Editor"

在“编辑器”部分检查此链接

version-editor

版本编辑器

回答by Edwin Ikechukwu Okonkwo

This worked for me using xcode 6 enter image description here

这对我使用 xcode 6 在此处输入图片说明

回答by SeanK

I've run into this issue, but it was a bit different. I had a merge issue with Git on my storyboard, so I had to manually edit the XML to resolve the conflict. After this, there was no 'Interface Builder-iOS Storyboard' option available in the "Open as" menu so I couldn't change it back to the visual editor. To fix this I simply restarted XCode and everything went back to normal.

我遇到了这个问题,但它有点不同。我的故事板上有一个 Git 合并问题,所以我不得不手动编辑 XML 来解决冲突。此后,“打开为”菜单中没有“界面生成器-iOS 故事板”选项可用,因此我无法将其改回可视化编辑器。为了解决这个问题,我只是重新启动了 XCode,一切都恢复了正常。

回答by piersb

After using SeanK's solution (restart XCode) I still manually needed to right-click the storyboard and choose Open as > Interface Builder - iOS Storyboard.

使用 SeanK 的解决方案(重新启动 XCode)后,我仍然需要手动右键单击情节提要并选择打开为 > 界面生成器 - iOS 情节提要。

回答by Viktor Kucera

If you have more than just one storyboard go back and forth - click different one, go back to the one you want to display as an iOS storyboard. It's not XML any longer.

如果您有多个故事板,请来回切换 - 单击不同的故事板,返回到要显示为 iOS 故事板的那个。它不再是 XML。

回答by Dalal Alharbi

Change the extension like this "your_storyboard.storyboard" then right-click MainStoryboard.storyboard, then choose "Open as >" and then "Interface Builder - iOS Storyboard".

像这样更改扩展名“your_storyboard.storyboard”,然后右键单击 MainStoryboard.storyboard,然后选择“Open as >”,然后选择“Interface Builder - iOS Storyboard”。