Computer >> บทช่วยสอนคอมพิวเตอร์ >  >> การเขียนโปรแกรม >> JavaScript

ทำให้ iOS UIWebView แสดง mobile website ถูกต้อง

เพื่อแสดง mobile website ถูกต้อง ลอง fix:

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

อีกวิธีตั้งค่า:

NSString *js = [NSString stringWithFormat:@"document.body.style.zoom = 0.8;"];
[webView stringByEvaluatingJavaScriptFromString:js];