-2

I have a UIWebView and I am just displaying some text. I am using html text to format the UIWebView. How can I include a image/UIImage inside it? I need to display an image with a fixed frame.

katzenhut
  • 1,742
  • 18
  • 26
Rory Lester
  • 2,858
  • 11
  • 49
  • 66

1 Answers1

5

Use img tag. Inject this in your HTML code & render it in UIWebView.

This should help -

NSString *html = @"<html><body style='margin:0;'><img width='300' height='300' src='my_test_image.jpg'></body></html>";
[web loadHTMLString:html baseURL:[NSURL fileURLWithPath:[[NSBundle mainBundle] bundlePath]]];
Srikar Appalaraju
  • 71,928
  • 54
  • 216
  • 264