views:

37

answers:

3

A upcoming iPhone app will comes with about 20 UIViewControllers which does not have any hierarchical relationship among them. Potentially any UIViewController can/will jump to another UIViewController. What is the best way to handle the switching among UIViewControllers for this app? Thanks!

A: 

Use a table to select which one to go to. Pretty much the only view that can handle a selection of 20 elements without getting awkward.

willcodejavaforfood
A: 

You'll need another object to manage all the view controllers. This can be your app delegate, or it can be an object dedicated to managing views. Depending on how your app works, you may want to create another managing ViewController to present specific views in a manner similar to a UITabBarController or a UINavigationController. In this case, each of your 20 UIViewControllers will have their views presented as a subview of the managing ViewController.

John Franklin
A: 

You can use NSMutableArray to maintain those UIViewControllers. A sample codes I studied keep 3 UIViewControllers normally, and assign [NSNull null] into array for those freed or un-loaded UIViewControllers. UINavigationController is convenient, and it maintains its viewControllers by array too.

Toro
I cannot afford a `UINavigationController` as the screen is all used by designer's (non-standard) UI elements. Pressing some of the UI elements may jump to certain function (screens) and so I cannot use a UINavigationController. Thanks.
ohho
You are welcome. Maybe you can maintain UIViewControllers with NSMutableArray by self. QuartzCore framework or UIView's class methods are helpful for animation of switching views.
Toro