How to make iOS UIWebView display a mobile website correctly?



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];
Updated on: 2020-01-29T06:28:55+05:30

110 Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements