我想向UIWebview显示soap响应..
我的肥皂反应是,
< p>< img src =“http://img.gawkerassets.com/img/17u1vg3xyeuipjpg/xlarge.jpg”width =“410”data-size =“large”/>< / p&gt ;< p>< a rel =“lytebox”href =“http://img.gawkerassets.com/img/17u1vg3xyeuipjpg/original.jpg”> < a href =“http://img.gawkerassets.com/img/17u1vg3xyeuipjpg/original.jpg”rel =“modal”>< / a> < p>< / a>在分享歌曲的播放列表之前,只需点击几下,混音带就是爱的劳动;一个耗时的项目。每首歌都经过仔细考虑。当然,现在这一切都已经消失了,但MakerBot让人想起的这款DIY MP3播放器可以帮助它恢复原状。< img src =“http://feeds.feedburner.com/r/GizmodoAustralia/4/ zFs-k-3__1I“height =”1“width =”1“/>
喜欢上面..
使用此代码加载对UIWebview
的soap响应[webView loadHTMLString:soapresponse baseURL:nil];
在webview中我想清除标签并显示内容。
任何人都可以帮我这样做..
谢谢
答案 0 :(得分:1)
编辑解码HTML实体,例如& LT;到< :使用NSString+HTML
NSString *strEncodeHTML = @"<p><img src="img.gawkerassets.com/img/17u1vg3xyeuipjpg/xlarge.jpg" width="410" data-size="large"/></p><p><a rel="lytebox" href="img.gawkerassets.com/img/17u1vg3xyeuipjpg/…; <a href="img.gawkerassets.com/img/17u1vg3xyeuipjpg/original.jpg" rel="modal"></a> <p></a>content here.img src="feeds.feedburner.com/r/GizmodoAustralia/4/zFs-k-3__1I" height="1" width="1"/>";
strEncodeHTML = [[[strEncodeHTML stringByReplacingOccurrencesOfString:@"<" withString:@"<"] stringByReplacingOccurrencesOfString:@">" withString:@">"] stringByReplacingOccurrencesOfString:@""" withString:@"\""];
NSLog(@"%@",strEncodeHTML);
NSString *strHTML = [NSString stringWithFormat:@"<html><body>%@<body></html>",strEncodeHTML] ;
[webView loadHTMLString:strHTML baseURL:nil];
加载html内容,如下所示:
NSString *strHTML = [NSString stringWithFormat:@"<html><body>%@</html>/<body>",yourSoapresponse];
[webView loadHTMLString:strHTML baseURL:nil];
下面给出了例子:
NSString *strHTML = [NSString stringWithFormat:@"<html><body><p><img src=\"http://img.gawkerassets.com/img/17u1vg3xyeuipjpg/xlarge.jpg\" width=\"410\" data-size=\"large\"/></p><p><a rel=\"lytebox\" href=\"http://img.gawkerassets.com/img/17u1vg3xyeuipjpg/original.jpg\"> <a href=\"http://img.gawkerassets.com/img/17u1vg3xyeuipjpg/original.jpg\" rel=\"modal\"></a> <p></a>Before sharing a playlist of songs with a crush was as simple as a few clicks, the mixtape was a labour of love; a time-consuming project. Every song was carefully considered. That’s all gone now, of course, but this DIY MP3 player conjured up by MakerBot can help bring it back.<img src=\"http://feeds.feedburner.com/r/GizmodoAustralia/4/zFs-k-3__1I\" height=\"1\" width=\"1\"/></html>/<body>"];
[webView loadHTMLString:strHTML baseURL:nil];