Xcode 5 中缺少 ViewController.xib
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/19612108/
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
Missing ViewController.xib in Xcode 5
提问by Nyxynyx
I'm new to iOS programming and is currently following the tutorial at http://codewithchris.com/demo-app-with-xcode-and-interface-builder/
我是 iOS 编程的新手,目前正在学习http://codewithchris.com/demo-app-with-xcode-and-interface-builder/ 上的教程
We first create a new project using the Single View Application
library.
我们首先使用Single View Application
库创建一个新项目。
Question:About half way into the tutorial, it says Once you have ViewController.xib opened on the left pane and ViewController.m opened on the right pane...
However there is no .xib file anywhere in the Project Navigator, and this is the first mention of an .xib file in the tutorial.
问题:在教程进行到一半时,它说Once you have ViewController.xib opened on the left pane and ViewController.m opened on the right pane...
然而在项目导航器中的任何地方都没有 .xib 文件,这是教程中第一次提到 .xib 文件。
Am I supposed to get a .xib file somewhere along the way? If so, which step will create the .xib?
我应该在途中的某个地方得到一个 .xib 文件吗?如果是这样,哪个步骤将创建 .xib?
回答by PiotrK
XIB is an older format of Interface Builder. In newer versions of Xcode, by default, the project is created with a storyboard (Main.storyboard
in your project). The difference is that in storyboards, you can see all the views of your app at once(and transitions between them), and with XIBs you have to keep them separately.
XIB 是一种较旧的 Interface Builder 格式。在较新版本的 Xcode 中,默认情况下,项目是使用故事板(Main.storyboard
在您的项目中)创建的。所不同的是,在故事板,你可以看到你的应用程序的所有视图一次(它们之间和过渡),并与XIBs你必须单独保管。
I'm not sure about this (can't check it right now), but if you insist on using XIBs, there should be a checkbox somewhere during creating a project. Anyway, I recommend you getting familiar with the storyboards, they are supposed to be a successor to XIBs.
我对此不确定(现在无法检查),但是如果您坚持使用 XIB,则在创建项目期间应该在某处有一个复选框。无论如何,我建议您熟悉故事板,它们应该是 XIB 的继承者。
As I can see in the tutorial, the author says 'XIB' even if he has a storyboard in his project, probably because he got used to XIBs. All in all, they are very similar in usage.
正如我在教程中看到的那样,即使他的项目中有故事板,作者也会说“XIB”,这可能是因为他习惯了 XIB。总而言之,它们的用法非常相似。
回答by Nikos M.
Actually storyboards contain .xibs (in your project one .xib as you created single view app.) The xib is just the user interface file shown in your second screenshot.
实际上,故事板包含 .xibs(在您创建单视图应用程序时,在您的项目中是一个 .xib。)xib 只是您的第二个屏幕截图中显示的用户界面文件。
You just have to click the "Show assintant editor" on top right (the button with the suit) to split the xcode window and see the xib alongside the viewcontroller header/or implementation files.
您只需单击右上角的“显示助手编辑器”(带有套装的按钮)即可拆分 xcode 窗口并在视图控制器头文件/或实现文件旁边查看 xib。