tags:

views:

439

answers:

3

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? 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. The choices are Item A or Item B. b.) If Item A is chosen, view A should be loaded. c.) It Item B is chosen, view B should be loaded.

Thanks in advance.

A: 

To me, what you're describing sounds like three views.

1. Root View
This view has two buttons (or other controls) that allow the user to select where they would like to go.

2. View A
A view with the necessary controls and data.

3. View B
A view with the necessary controls and data.

The actual transition between the views could involve a 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. Otherwise, views A and B could be presented modally when the appropriate button is clicked by calling [rootView.presentModalViewController:animated].

Is that what you're looking for?

Justin Gallagher
A: 

From the users point of view, what is the difference between using UINavigationController and the modal option you mention?

Thanks in advance.

jp chance
A UINavigationController is the standard for navigating between hierarchical data. The UINavigationController will have a navigation bar across the top of the screen and will have a "Back" button in the upper left once View A or View B is pushed. Also, the views will slide in and out from the left and right. The modal view will slide up from the bottom (by default, you can change this). You will have to create controls on View A and View B to dismiss the modal view at which point it will slide down off the bottom of the screen (again by default).
Justin Gallagher
A: 

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?

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)

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.

The real answer probably depends upon what your two views need to do, and what kind of UI they present.

Christopher Fairbairn