0

I want to load a html file with an iPad application, but in the html file there is an image, and that image has a touch event. When I load the html file with webview the image does not appear. Why is that?

I am using code :

UIWebView *webView = [[UIWebView alloc]initWithFrame:CGRectMake(0, 0, 320, 480)];
webView.backgroundColor = [UIColor lightGrayColor];
NSString *htmlFile = [[NSBundle mainBundle] pathForResource:@"2line1" ofType:@"html"];
NSData *htmlData = [NSData dataWithContentsOfFile:htmlFile];
[webView loadData:htmlData MIMEType:@"text/html" textEncodingName:@"UTF-8" baseURL:[NSURLURLWithString:@""]];
PaulG
  • 13,871
  • 9
  • 56
  • 78
  • If it's a local image, check this out: http://stackoverflow.com/questions/747407/using-html-and-local-images-within-uiwebview – bendytree Jun 12 '13 at 12:47

1 Answers1

0

Try This way,

  htmlString = [NSString stringWithFormat = @"<p><img src='https://yourpath/images/image.png'></p>";
     [yourwebview loadHTMLString:htmlString baseURL:nil];
Jitendra
  • 5,055
  • 2
  • 22
  • 42
user2462484
  • 39
  • 1
  • 2
  • 6