基于视图的应用程序? - 请解释一下
XCode:“此模板为使用单个视图的应用程序提供了一个起点。它提供了一个视图控制器来管理视图,以及一个包含视图的 nib 文件。”
这到底意味着什么? (即“单视图”实际上意味着什么)
1) 这意味着您的应用程序将只有一个处于活动状态的视图屏幕
2) 这意味着您的应用程序将能够使用单个视图控制器拥有任意多个屏幕。
好吧,如果您的应用程序有多个屏幕怎么办?不是单一视图屏幕,是否仍然适合基于视图的应用程序模板?
示例
Screen1(主):在此屏幕上有 3 个按钮,“打开 Form1”、“打开 Form2”、“打开 Form3”
单击按钮时,将打开关联的屏幕,
按“ “打开表单 1”按钮将打开“表单 1”屏幕2
按“打开表单 2”按钮将打开“表单 2”屏幕3
按“打开表单 3”按钮将打开“表单 3”屏幕4
当用户完成表单并提交时,会出现感谢屏幕显示 因此,在此示例中总共有 5 个屏幕。
每个表单屏幕包含不同的文本字段输入和信息,这是否被视为基于视图的应用程序?
XCode: "This template provides a starting point for an application that uses a single view. It provides a view controller to manage the view, and a nib file that contains the view."
What does that even mean? (ie what does Single view actually mean)
1) This means that your application will only have a single view screen that is active
2) This means that your application will be able to have as many screens as you like using a single view controller.
Ok now what if your application has multiple screens? not a single view screen, is still suitable under a view based application template?
Example
Screen1(main): on this screen you have 3 buttons, "Open Form1", "Open Form2", "Open Form3"
When the button is clicked it opens up the associated screen,
Press the "Open Form1" button opens up "Form1" screen2
Press the "Open Form2" button opens up "Form2" screen3
Press the "Open Form3" button opens up "Form3" screen4
When the user completes the form and submits it, a thank you screen is displayed
therefore in this example there would be a total of 5 screens.
Each form screen contains is different, textfield inputs, and information, is this considered as a view based application?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
基于视图的应用程序只是一个模板,表明您的应用程序将是基于视图的。这意味着您可以拥有任意数量的视图,因为此模板附带一个视图控制器(顾名思义,它可用于控制视图......例如,通过动画显示/隐藏它们)。
该模板以添加到应用程序视图控制器的一个视图开始。您可以向该控制器添加任意数量的视图。
所以,对你的问题是的。例如,您可以使用它来创建您提到的应用程序,其中您提到的任何“屏幕”都是一个视图,并且您可以使用应用程序视图控制器来显示每个屏幕,以对每个视图的显示或隐藏进行动画处理。
View-based app is just a template to say that your app will be view-based. That means that you can have any number of views you want, as this template comes with a view controller (that, as the name says, can be used to control the views... show/hide them with animation, for example).
The template starts with ONE VIEW that is added to the app view controller. You can add any number of views to that controller.
So, yes to your questions. You can use this to create the app you mention, where any of the "screens" you mention would be a view, for example and you can show each one using, for instance, the app view controller to animate each view showing or hiding.
这意味着模板将创建一个视图和相应的视图控制器以及应用程序委托、主窗口。这还将执行必要的操作以将此视图添加到主窗口,并在应用程序运行时加载。这只是一个模板。然后,您可以根据需要创建任意数量的视图和视图控制器。
That means the template will create one view and corresponding view controller along with app delegate, main window. That will also do the necessary things to add this view to main windows, and load when app runs. This is just a template. Then you can crate any number of views and view controllers as you want.
这意味着您启动项目所使用的模板提供了一个 ViewController 以及与该视图关联的 XIB。正如第一个答案所说,您可以使用此模板来构建提到的应用程序。
但是,您可能希望考虑用户将如何与您的应用程序交互。您是否允许在屏幕上前后移动,在这种情况下,您可能需要考虑基于导航的应用程序,在该应用程序中将屏幕推入/弹出到堆栈上,以便在它们之间轻松移动。
您可能还有一个概念,允许用户在每个屏幕页面之间随意跳转,在这种情况下您可能想要实现 TabBar 应用程序。
或者你也可以自己实现这一切。归根结底,这将是您的应用程序设计,而模板只是让您继续前进的起点。我建议,如果您刚开始进行 iOS 开发,那么为您希望实现的每个屏幕使用 1 个 ViewController 匹配一个 XIB,以保持简单。
This means that the template you are starting the project with provides a single ViewController, and associated XIB for the View. As the first answer says you could use this template to build the application mentioned.
HOWEVER you may wish to think about how the user is going to interact with your app. Will you allow stepping back and forwards through the screens, in which case you may want to consider the Navigation Based app where you push/pop screens onto a stack to allow easy movement between then.
You might also have a concept of allowing the user to jump at will between each of the screen pages in which case you might want to implement a TabBar application.
Or you could just implement it all yourself. At the end of the day it will be your application design, and the template is only a starting point to get you going. I would suggest that if you are starting out with iOS development however to go with 1 ViewController matched a XIB for each screen you wish to implement to keep things simple.