views:

76

answers:

1

Hi. After much reading and many tutorials I'm now attempting to write my first iPhone app, but already starting to run into complications so want to go back to basics and ask whether I've got the fundamental UI design correct:

  • MainWindow.xib has a TabBarController. The TabBarController contains 3 NavigationControllers, each containing a subclassed UIViewController (lets say VC1, VC2 and VC3)

Thus far, straightforward and covered by many tutorials. But now my own thinking takes over and my uncertainty increases:

  • One of those 3 views should display a list of data, with a single level of navigation (drill down) to a detailed view.

So why doesn't the TabBarController contain 2 UIViewControllers and 1 UITableViewController, you might ask me. Well, because:

  • I also want to allow the user to switch between 2 "types" of data (good comparison would be "Email In" and "Email Out")
  • The user should also be able to filter the list (eg. New, Starred, From xyz, etc)

So, I've decided I need a Toolbar.

  • The Toolbar contains a 2 part segmented control for switching between data types and a button, to load a Settings page where the filters can be defined.

Therefore VC2 loads VC2.xib, which contains the following:

  • A view (containing a Toolbar)
  • A subclassed UITableViewController (for displaying my list data)
  • A subclassed UIViewController (for displaying a settings page)

  • I then of course, use insertSubview to adapt the view contents according to selections in the Toolbar

Does that all sound reasonable or is there perhaps a flaw in my thinking or a better way to achieve my needs?

I don't want to go into detail here about the actual problem I'm now having. That, assuming my basic architecture is plausible, is a separate question. First I need to know please, whether my basic thinking is correct ;)

Thanks in advance.

A: 

Here's my thinking. The design looks pretty good. Just a few things I might do differently.

  1. To switch between 2 different types of data

I don't know if this is how you intended to do it but you could define 1 UITableViewController and 2 different datasources, then switch between them instead of defining 2 different UITableViewControllers.

  1. Settings button

Instead of designing and loading an entirely new UIViewController for the settings page you could just popup a UIPickerView. Then to adapt the view's contents you call [tableview reloadData]

domino
Thanks for your ideas domino. Yes, switching between 2 datasources was indeed how I envisaged things. I was just a bit unsure where to put the 2 piece seg. control. A Toolbar, bearing in mind I've already got a Tabbar and Navbar, seemed like overkill. After thinking things through, the obvious answer of course is into the Navbar (centre).Which just leaves the question of the filter settings, which is more of a question where to place a button. But again, after thinking things through have several new ideas.Really it was the Toolbar that was bugging me but that's gone now thankfully :)
Rich