如何在 Xcode 中向单视图应用程序添加新视图

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/13040586/
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-15 01:54:45  来源:igfitidea点击:

How do I add a new view to a single view application in Xcode

objective-ciosxcodeinterface-builder

提问by Herbie999

I started my app as a single view application. I have the view with various buttons and labels connected to code. I want to add a button that links to another view.

我开始我的应用程序作为一个单一的视图应用程序。我有各种按钮和标签连接到代码的视图。我想添加一个链接到另一个视图的按钮。

I found a tutorial that guided me to click on the project and add a UIView subclass. However there is no option for that ( I think because I started it as a single view application).

我找到了一个教程,指导我单击项目并添加一个 UIView 子类。但是,没有选择(我认为是因为我将它作为单一视图应用程序启动)。

I'm pretty new to all this so if anyone can outline a simple way for me to do this that would be great! I am using Xcode version 4.3.2.

我对这一切都很陌生,所以如果有人能概述一个简单的方法让我做到这一点,那就太好了!我正在使用 Xcode 版本 4.3.2。

Thanks!

谢谢!

回答by user427969

You need to add a new Objective C class. Please refer to this:

您需要添加一个新的Objective C class. 请参考这个:

How to create new View Controllers in XCode 4.3

如何在 XCode 4.3 中创建新的视图控制器

回答by Adrian P

If you started the app as single view using xib file the to add a class just go to name of the project on the left pane and right click on it. Then choose add new file. The pop up will appear to allow you to choose what type of class you want to add. Depending to what the new view is you can choose uiview controller or uitableview controller and so on. Just make sure you check mark with xib for interface user. That should do it. Hope it helps. Adrian

如果您使用 xib 文件将应用程序作为单一视图启动,则添加类只需转到左侧窗格中的项目名称,然后右键单击它。然后选择添加新文件。将出现弹出窗口,让您选择要添加的课程类型。根据新视图是什么,您可以选择 uiview 控制器或 uitableview 控制器等。只需确保为界面用户选中 xib 标记即可。那应该这样做。希望能帮助到你。阿德里安