当前位置:首页 > 操作系统 > Ios

iOS 修改网络图片的大小 宽和高

  //image宽和高 好用 NSString *strTemplateHTML = [NSString stringWithFormat:@"<html><head><style>img{max-width:320.0;height:auto !important;width:auto !important;};</style></head><body style=‘margin:0; padding:0;‘>%@</body></html>", @"insert your html content here"];
[webView loadHTMLString:strTemplateHTML baseURL:nil];
//代理执行时调用
- (void)webViewDidFinishLoad:(UIWebView *)webView1
{
    //修改服务器页面的meta的值 就是文本的宽高 定义成 系统手机宽高     
    NSString *meta = [NSString stringWithFormat:@"document.getElementsByName("viewport")[0].content = "width=%f, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no"", webView.frame.size.width];
    [webView1 stringByEvaluatingJavaScriptFromString:meta];
}

【说明】本文章由站长整理发布,文章内容不代表本站观点,如文中有侵权行为,请与本站客服联系(QQ:254677821)!