Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Multiple ViewControllers and MultipleViews - Best Approach

 
Giovanni Lima
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
ranger
Sheriff
Posts: 17278
6
IntelliJ IDE Mac Spring
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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

Mark
 
Giovanni Lima
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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!!
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic