iPhone UITableView Nested Sections

For the acani iPhone app, I'd like display groups (based on interests) in a UITableView. I'd like to organize the groups taxonomically, e.g.:

  • Sports
    • Bat-and-ball
      • Baseball
      • Softball
      • Cricket
    • Hockey
      • Field Hockey
      • Ice Hockey
      • Roller Hockey
  • Engineering
    • Electrical Engineering
    • Biochemical Engineering

How should I arrange this on a UITableView?

I'm thinking that there should be a root UITableView that will have the sections Sports & Engineering, and the cells Bat-and-ball & Hockey will be under the Sports section, and the cells Electrical Engineering & Biochemical Engineering will be under the Engineering section.

Then Bat-and-ball should have its own UITableView, which should have cells Baseball, Softball, and Cricket.

Does this sound like a good way to arrange the UI?

Do you have any sample code or links to Xcode sample code for a UI like this? There's gotta be an Xcode sample project that does something like this. Perhaps the periodic table of elements project or Core Data Books?

Thanks!

Matt

Answers


You got it. A UITableView really isn't designed to show more than two levels of a hierarchy, as sections and rows. If you want to show more than two levels, a "drill-down" approach used in most (all?) iOS apps, where tapping a row presents another UITableView on the navigation stack. (As you say.)

There are lots of Apple sample code projects that use this design pattern.

Edit: just checked and DrillDownSave is a good example, as is SimpleDrillDown.


Need Your Help

Testing with Spring and Maven: applicationContext

spring unit-testing maven

Seems that question old as world, but I still can't find out the solution..

Pyqt qtablewidget using all window space

python qt user-interface pyqt

I'm trying to make a simple UI with: a qtablewidget, a pushbutton and a status bar.

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.