简体   繁体   English

iPhone SDK:如何加载其他视图?

[英]iPhone SDK: How to load a different view?

Suppose that I want to create and application and that application will have two windows and a menu mechanism. 假设我要创建一个应用程序,该应用程序将有两个窗口和一个菜单机制。 How do I accomplish this on iPhone? 如何在iPhone上完成此操作? I know how to create a single view and have that displayed but what I want is this ability: 我知道如何创建一个视图并显示它,但是我想要的是此功能:

a.) Upon loading app, show a navigation mechanism. a。)加载应用程序后,显示导航机制。 The choices are Item A or Item B. b.) If Item A is chosen, view A should be loaded. 选择是项目A或项目B。b。)如果选择了项目A,则应加载视图A。 c.) It Item B is chosen, view B should be loaded. c。)如果选择了项目B,则应加载视图B。

Thanks in advance. 提前致谢。

To me, what you're describing sounds like three views. 对我来说,您所描述的听起来像是三个视图。

1. Root View 1.根视图
This view has two buttons (or other controls) that allow the user to select where they would like to go. 该视图有两个按钮(或其他控件),它们使用户可以选择他们要去的地方。

2. View A 2.查看A
A view with the necessary controls and data. 具有必要控件和数据的视图。

3. View B 3.视图B
A view with the necessary controls and data. 具有必要控件和数据的视图。

The actual transition between the views could involve a UINavigationController . 视图之间的实际过渡可能涉及UINavigationController If so, the root view would be pushed onto the UINavigationController 's stack initially, and clicking the buttons would push either view A or B onto the stack. 如果是这样,则最初会将根视图推入UINavigationController的堆栈,单击按钮会将视图A或B推入堆栈。 Otherwise, views A and B could be presented modally when the appropriate button is clicked by calling [rootView.presentModalViewController:animated] . 否则,当通过调用[rootView.presentModalViewController:animated]单击适当的按钮时,视图A和B可以模态显示。

Is that what you're looking for? 那是您要找的东西吗?

Since you mention a "menu", is it possible the user may like to go back and change their selection (A or B) at some stage? 既然您提到了“菜单”,那么用户是否有可能想在某个阶段返回并更改其选择(A或B)?

In that case you may like to also investigate if a Tab Bar Controller based application fits your needs (similiar to the built in Clock application) 在这种情况下,您可能还想研究基于Tab Bar Controller的应用程序是否满足您的需求(类似于内置Clock应用程序)

This would always display two buttons at the bottom of the screen which the user could use at any point in time to switch between the two modes. 这将始终在屏幕底部显示两个按钮,用户可以在任何时间使用它们在两种模式之间进行切换。 it would automatically handle the switching of views "A" and "B" within the main part of the screen. 它会自动处理屏幕主要部分中视图“ A”和“ B”的切换。

The real answer probably depends upon what your two views need to do, and what kind of UI they present. 真正的答案可能取决于您的两个视图需要做什么,以及它们呈现哪种UI。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM