How to make iOS UIWebView display a mobile website correctly?

JavascriptWeb DevelopmentFront End Scripts

To display the mobile website correctly, try the following fix:

mywebview.scalesPageToFit = YES;
mywebview.contentMode = UIViewContentModeScaleAspectFit;

You can also set the following:

NSString *js = [NSString stringWithFormat:@"document.body.style.zoom = 0.8;"];
[webView stringByEvaluatingJavaScriptFromString:js];
raja
Published on 10-Apr-2018 11:22:00
Advertisements