title: Fit image of random size into a UIWebview (IOS)
body: <p><img src="https://i.stack.imgur.com/fStaO.jpg" alt=""></p>
  
  <p>I want to fit large image into UIwebview with keeping image ratio same as image view.</p>
  
  <p>How can i do it.?</p>
  
  <p>My code as follows to fit image in Uiwebview.
  if image is large then display is not good.</p>
  
  <pre><code>                CGFloat screenWidth = self.view.frame.size.width;
                  CGFloat screenHeight = self.view.frame.size.height;
  
                  NSString *htmlString = [NSString stringWithFormat:@"%@", @"&lt;html&gt;&lt;head&gt;&lt;meta name='viewport' content='user-scalable=yes,width=device-width'&gt;&lt;/head&gt;&lt;body bgcolor='000000'&gt;&lt;img src='%@' width='%f' height='%f' style='max-width:200% max-height:200%'&gt;&lt;/body&gt;&lt;/html&gt;"];
                  imageHTML  = [[NSString alloc] initWithFormat:htmlString, fileUrl, screenWidth, screenHeight];
  
          [Webview loadHTMLString:imageHTML baseURL:nil];
          [imageHTML release];
  </code></pre>