File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes iOS and the fly likes Multiple ViewControllers and MultipleViews - Best Approach Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Mobile » iOS
Bookmark "Multiple ViewControllers and MultipleViews - Best Approach" Watch "Multiple ViewControllers and MultipleViews - Best Approach" New topic

Multiple ViewControllers and MultipleViews - Best Approach

Giovanni Lima

Joined: Mar 08, 2011
Posts: 13
I have a very large form to build in my ipad application and I'm note sure which approach( between create multiple views in or multiple viewcontrollers ) to follow. Well, I have decided to split may form in logical sections, so I want use a splitviewcontroller with a root( a tableviewcontroller with the sections) and multipleviecontrollers for each sections. When the user select a row in tableview I will show the correspondent viewcontroller. I'm saving a reference for each viewcontroller in my app_delegate and the app_delegate also is the responsible for change the viewcontrollers. Is this the best approach? There is other approach to follow? About the multiple view I was thinking to put multiple view in the same xib file and then choose based in tag as the use tap the row in rootviewcontroller's tableview.

Thanks in advance. And sorry for my bad english.. Learning!
Mark Spritzler

Joined: Feb 05, 2001
Posts: 17276

I understand completely what you are talking about. I have that similar in my TubeOrganizer app. But I definitely create a View and a View Controller for each visual view I needed. That includes separate xib/nib files. This was really helpful with my app being Universal, in that a few of the smaller subview being their own nib and viewController I could reuse it for both the iPhone and iPad apps.

Now as far as best practice, I think having the app delegate hold onto more detail views and objects and be in control is like global variables.

Just remember in that SplitViewCOntroller the SplitView and SplitViewController are the parent views with at minimum two views and two viewControllers. One for the left side and one for the right side. Then you can break apart your right side into different Views and ViewControllers and have your DetailViewCOntroller have those different views as subviews.

Hope that helps


Perfect World Programming, LLC - iOS Apps
How to Ask Questions the Smart Way FAQ
Giovanni Lima

Joined: Mar 08, 2011
Posts: 13
Thanks for your reply.
Following what you said at the end, you mean that my detailviewcontroller would be the responsible for switch between others view controllers? or simple views? I can create differente Views in diferente nibs( because they too big ) and just save a reference in my detailviewcontroller and switch between them as subviews in my detailviewcontroller?

Thanks in advance!!
I agree. Here's the link:
subject: Multiple ViewControllers and MultipleViews - Best Approach
jQuery in Action, 3rd edition