xcode 如何将我的新视图添加到故事板?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/14565970/
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
How do I add my new View to the storyboard?
提问by fredley
I started with the template Master/Detail project. I then added another ViewController
, with a xib. I'd like this view to be the one that is displayed when the app launches. The problem is I can't figure out how to add it to the Storyboard.
我从模板 Master/Detail 项目开始。然后我添加了另一个ViewController
,带有 xib。我希望此视图成为应用程序启动时显示的视图。问题是我不知道如何将它添加到故事板。
I can add a new empty view to the Storyboard, but I can't link it up with the ViewController
files I just created. Do I need to start again by adding a new view to the Storyboard, laying out my view there?
我可以向 Storyboard 添加一个新的空视图,但我无法将它与ViewController
我刚刚创建的文件链接起来。我是否需要通过向 Storyboard 添加新视图并在那里布置我的视图来重新开始?
回答by rdelmar
Yes, it would be easiest, if you just make that new view in the storyboard. If you have a complicated view that you set up in your xib, you can copy and paste into a new controller in the storyboard (delete the empty view from the controller first). After, you've copied your view into the new controller, you can change its class to the subclass you made.
是的,如果您只是在故事板中创建新视图,那将是最简单的。如果您在 xib 中设置了一个复杂的视图,您可以复制并粘贴到故事板中的新控制器中(首先从控制器中删除空视图)。之后,您已将视图复制到新控制器中,您可以将其类更改为您创建的子类。