您的当前位置:首页正文

webView加载HTML页面

来源:华拓网


NSDictionary * dic = [NSJSONSerialization JSONObjectWithData:data options:NSJSONReadingMutableContainers error:nil];

NSDictionary * lastDic = dic[@"data"];

NSString * contentPath = lastDic[@"wap_content"];

//NSLog(@"%@",contentPath);

//如果不能直接获取数据 需要转码后才可使用

//NSString * webPath = [contentPath stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding];

[self.MyWebView loadHTMLString:[NSString stringWithFormat:@"<body>%@</body>",contentPath] baseURL:[NSURL URLWithString:contentPath]];