Designing a tabbed tableview application for iPhone
I'm in the process of learning and designing an app for our company. At its heart, it has a list of "alarms" which when clicked on, goes to a more detailed view with a toolbar to perform tasks upon that "alarm".
I'm having a devil of a time working out how to structure this application. I have something that works currently (i'll explain it in a sec), but now I'm about to hook up the data source for the table and I'm getting myself lost.
At the main screen, there is to be a list of "alarms". This list should be able to be filtered with 3 categories (All, Category 1, Category 2) where the categories are subsets of all the "alarms". I've implemented this using a TabBarController.
Within each tab, I've got a NavigationController (to ha开发者_开发知识库ndle the navigation of between the list and the details) and it's main view is a custom UITableViewController that contains the custom table view.
As described, when you click a item, it navigates to a detailed view. This is all currently working but I'm concerned about the structure.
It's pretty obvious that I have a fair bit of duplication with the 3 different NavigationControllers, but I've read that subclassing the NavigationController is not recommened.
My questions are:
Is there a better way to structure this application? Is there a better filtering method (thats quick and easy) instead of a TabBar?
Where should the tableview datasource go? Most examples I've seen have it being created in the AppDelegate and then passed directly to the tableviewcontroller. My custom tabelviewcontroller is a couple of levels down the controller chain, how do I pass the datasource to it, or can I make the datasource "static"?
I hope that all made sense
Sounds as though you want one navigation controller and table view controller with a segmented control at the top to switch between the different data views. For an example of this kind of layout have a look at how the App Store app works when you select the Featured tab - it has a segmented control to switch between New, What's Hot and Genius.
精彩评论