Take the 2-minute tour ×
Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. It's 100% free, no registration required.

I just asked a question on StackOverflow, but I'm thinking that a part of it belongs here, as questions about design pattern are welcomed by the faq.

Here is my situation. I have developed almost completely a native iOS app. The last section I need to implement is all the rules of a sport, so that's a lot of text. It has one main level of sections, divided in subsections, containing a lot of structured text (paragraphs, a few pictures, bulleted/numbered lists, tables). I have absolutely no problem with coding, I'm just looking for advice to improve and make the best design pattern possible for my app.

My first shot (the last one so far) was a UITableViewController containing the sections, sending the user to another UITableViewController with the subsections of the selected section, and then one strange last UITableViewController where the cells contain UITextViews, sections header help structure the content, etc.

What I would like is your advice on how to improve the structure of this section. I'm perfectly ready to destroy/rebuild the whole thing, I'm really lost in my design here.. As I said on SO, I've began to implement a UIWebView in a UIViewController, showing a html page with JQuery Mobile to display the content, and it's fine. My question is more about the 2 views taking the user to that content. I used UITableViewControllers because that's what seemed the most appropriate for a structured hierarchy like this one. But that doesn't seem like the best solution in term of user experience..

What structure / "view-flow" / kind of presentation would you try to implement in my situation?

As always, any help would be greatly appreciated!


Just so you can understand better the hierarchy, with a simple example :

                          -----> Section 1   -----> SubSection 1.1   -----> Content
                          |                  -----> SubSection 1.2   -----> Content
                          |                  -----> SubSection 1.3   -----> Content
                          |
                          |
                          |
UINavigationController  -------> Section 2   -----> SubSection 2.1   -----> Content
                          |                  -----> SubSection 2.2   -----> Content
                          |                  -----> SubSection 2.3   -----> Content
                          |                  -----> SubSection 2.4   -----> Content
                          |                  -----> SubSection 2.5   -----> Content
                          |
                          -----> Section 3   -----> SubSection 3.1   -----> Content
                                             -----> SubSection 3.2   -----> Content

                      |------------------|   |--------------------|  |-------------|
                  1 UITableViewController   3 UITableViewControllers  10 UIViewControllers
                         (3 rows)              (with different         with a UIWebView
                                                number of rows)
share|improve this question
add comment

1 Answer

up vote 4 down vote accepted

The simplest way to achieve this is to write the documentation as a set of HTML files, include them as resources, and display them with a UIWebView. Use links to create the hierarchy; that's what they're for.

If you want to use the navigation controller's hierarchy as a way of presenting a back button, intercept all link clicks and push a new view onto the stack that contains a UIWebView. Tell it to load the destination of the previous view's link. Here's a Stack Overflow question about intercepting web view link clicks:

http://stackoverflow.com/questions/8437305/ios-uiwebview-intercept-link-click

This approach reduces your 14 (!) view controllers down to 1, and makes maintenance a matter of editing HTML files rather than a whole mess of views and view controllers.

share|improve this answer
    
Hi. Thanks for the answer. I've already started to write the html files for the contents. In Xcode, I was only going to create a single VC containing the WebView, and display whichever page I want int it. My real problem is I don't know how to present the sections and subsections to the user. I don't want him to get lost and/or spend a long time scrolling through the tables... My navigation can be native code, the last view only is html. Thanks for the link, it'll probably be useful. I'll leave the question unanswered for now just to see if new ideas come up. Thanks ! –  rdurand Oct 31 '12 at 18:53
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.