尝试使用 javascript 使用 initial-scale=1.0; maximum-scale=5.0 在这里设置你的值
ViewDidLoad 方法
NSString *embedHTML = @"<html><body bgcolor=#EAEAEA><font face='Myriad Pro' size='3'><meta name='viewport' content='width=device-width; initial-scale=1.0; maximum-scale=5.0; user-scalable=YES'/>";
NSString *endHtml=@"</font></body></html>";
NSString *strDes=[NSString stringWithFormat:@"%@%@%@",embedHTML,YourWebviewDescription,endHtml];
[self.webViewObj loadHTMLString:strDes baseURL:nil];
NSString *string = [NSString stringWithFormat:@"document.body.style.zoom = %f;", fontSizeSlider.value]; // I used sliderControl and its value is 1 to 5.
[webViewObj stringByEvaluatingJavaScriptFromString:string];
当我们改变滑块位置时(拖动滑块)
-(IBAction)sliderValueChanged:(UISlider*)sender
{
int font=(int)fontSizeSlider.value;
NSLog(@"font %d",font);
NSString *string = [NSString stringWithFormat:@"document.body.style.zoom = %f;", fontSizeSlider.value];
NSLog(@"string=%@",string);
[webViewObj stringByEvaluatingJavaScriptFromString:string];
}