UIWebView won't load images from bundle?

Discussion in 'iOS Programming' started by cstromme, Aug 24, 2009.

  1. cstromme macrumors regular

    Joined:
    Feb 26, 2007
    #1
    So I'm making an app to read a specific webforum, and I thought it would probably be a good idea to bundle the emoticons used on this forum in the app itself, and just parse the html and replace the <img src="http://boardurl/1.gif"> with a <img src="1.gif"> and thereby not having to use bandwidth for each one. But this doesn't seem to work.

    I've checked my compiled bundles, and the images are there (in the root), and as far as I can see this is supposed to work, yet it isn't. I have checked my code afterwards and the replacing of the string seems to work, so what else might be wrong here?

    This is one of the strings that have been replaced:
    HTML:
    <img class="BoardFace" src="4.gif" border="0" alt="grin" hspace="0" vspace="0">
    The pictures load fine if I don't replace that part before 4.gif
     
  2. Troglodyte macrumors member

    Joined:
    Jul 2, 2009
    #2
    Think about what you are asking it to load and where the gif will come from - will it try and get it from the the remote server or will it try and load it from your app bundle?

    Here's a clue...url's are relative unless otherwise specified.
     
  3. dejo Moderator

    dejo

    Staff Member

    Joined:
    Sep 2, 2004
    Location:
    The Centennial State
    #3
    Which part?
     

Share This Page