Take the 2-minute tour ×

I am working on an iPhone/iPad application. Trying to load very large image in UIImage view stored in local directory in app. Code:

NSString *path = [[NSBundle mainBundle] pathForResource:selectedImage ofType:@"jpg"];
NSString *cssString = @"<style type='text/css'>img {width: 100%; height: auto;} body { margin: 0; padding: 0; }</style>";
NSString *htmlString = [NSString stringWithFormat:@"<html><head>%@</head><body><img src=\"file://%@\" /></body></html>",cssString,path];
[webview loadHTMLString:htmlString baseURL:nil];

In iPhone and Simulator images gets loaded perfectly but when I try to run app in iPod touch 4g it misses the image in UI Webview. I guess there are some memory issues. Not sure. Any help.

Image size is: 640*5000

share|improve this question
make sure the name of image is same which you added in your project bundle bcz Simulator is not case-sensitive.. –  developer.mono Apr 8 '13 at 12:07
not that's no the issue. Iphone 4 loads perfectly. Problem is only with iPod –  Awais Tariq Apr 8 '13 at 12:43
add comment

1 Answer

may be this link1 or link2 will help you

We tried with the code and its working,

NSString *path = [[NSBundle mainBundle]pathForResource:@"imageName" ofType:@"png"];
       NSString *_path = [[NSBundle mainBundle] bundlePath];
          NSURL *baseURL = [NSURL fileURLWithPath:_path];
      [self.webobj loadData:[NSData dataWithContentsOfFile ath] MIMEType:@"image/png" textEncodingName:@"UTF-8" baseURL:baseURL];
share|improve this answer
add comment

Your Answer


