首页 > 移动平台 > 详细

iOS 对H5加载html的数据的一些基础设置

时间:2017-04-10 14:39:27      阅读:192      评论:0      收藏:0      [点我收藏+]

NSString *title = [NSString stringWithFormat:@"<p><font color=\"black\" size=\"4\"><strong>%@</strong></font> </p>",_webTitle]; //设置webView 标题打大小和颜色 以及加粗

NSString *title = [NSString stringWithFormat:@"<p><font color=\"black\" size=\"3\">%@</font> </p>",_webTitle];  //设置webView 标题打大小和颜色

NSString *dataa = [NSString  stringWithFormat:@"<style>img{max-width:320px}</style>%@",data];   //让h5 图片宽度 = 320

 NSString *time = [NSString stringWithFormat:@"<p><font color=\"gray\" size=\"2\">%@</font> </p>",_time];

 如果后台返回的是html的数据  不是url 

 NSString  *filePath = [NSString stringWithFormat:@"%@\n%@\n%@",title,time,dataa];

    

    financeWeb = [[UIWebView alloc] initWithFrame:CGRectMake(0,0, kUIScreenWidth, kUIScreenHeight-64)];

    financeWeb.delegate = self;

    [financeWeb.scrollView setBounces:YES];

    financeWeb.backgroundColor = [UIColor whiteColor];

    [self.view addSubview:financeWeb];

    [financeWeb loadHTMLString:filePath baseURL:nil];

 

iOS 对H5加载html的数据的一些基础设置

原文:http://www.cnblogs.com/Lovexiaohuzi/p/6688745.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!