Use UIWebView to display formatted content?

Discussion in 'iOS Programming' started by dantastic, Feb 17, 2011.

  1. dantastic macrumors 6502

    dantastic

    Joined:
    Jan 21, 2011
    #1
    Still learning I wonder what to use. I have a page that is a bit of a summary. I want to be able to display formatted content in 2 or 3 paragraphs. The content will include formatted text, images and links to other views inside my application.

    I realize I can use a UITableView and cook up a handful of custom cells that will serve every purpose. But I was thinking, is UIWebView maybe a better option here?

    If using UIWebView my app must be able to generate the html pages itself, are there classes for this already or will I have to create from scratch?

    The other thing is that I want links within the text that point to other views in my application, will this work?

    Or should I be looking at a different technology altogether here?

    thanks!
     
  2. robbieduncan Moderator emeritus

    robbieduncan

    Joined:
    Jul 24, 2002
    Location:
    London
    #2
    In the SELOCTechWiki app (see my sig) is use UIWebViews to present each article. I store the articles in the app as HTML which makes this easier. It's pretty easy to use the UIWebView delegate to catch clicks on links. At that point you can do whatever you want: allow the webview to open the link, open the link in Safari or push another view controller.
     
  3. dantastic thread starter macrumors 6502

    dantastic

    Joined:
    Jan 21, 2011
    #3
    Excellent, It was the links I was worried about but if I can catch them as you say it's all gravy.
     
  4. robbieduncan Moderator emeritus

    robbieduncan

    Joined:
    Jul 24, 2002
    Location:
    London
    #4
    I made life easy for myself: when I scrape the wiki the tool I wrote changes the links. So if the link is to another wiki page the link becomes something like article://article_id and if it's an internal image (so is in the application bundle as part of the scrape) it becomes image://image_id. In the link handler I can then just look at the protocol and do the correct thing.
     

Share This Page