2012-08-13 51 views
0

我加載從網站HTML中使用以下方式HTML是不是在一個UIWebView

 -(void)connectionDidFinishLoading:(NSURLConnection *)connection{ 
//CategoriesParser *parser=[[CategoriesParser alloc]init]; 
//[parser setDelegate:self]; 
//[parser startParsing:xmlData]; 

NSString *[email protected]"<html><head></head><body>"; 

NSString* newStr = [[[NSString alloc] initWithData:urlData 

              encoding:NSUTF8StringEncoding] autorelease]; 

newStr=[NSString stringWithFormat:@"<html><head></head><body>%@</body></html>",newStr]; 


[webView loadHTMLString:newStr baseURL:nil]; 

}

加載但不幸的是它是否顯示在網頁視圖的HTML代碼

<p style="text-align: justify;"><span style="font-family: helvetica; font-size: small;">The UAE manages what some Arab cities fail to achieve; 

所以請通過在webview中加載html字符串來幫助我做錯什麼

+0

什麼urlData? – Jessedc 2012-08-13 05:47:42

+0

可以登錄html字符串..? – vishy 2012-08-13 05:57:57

+0

什麼是URL數據... – Rajneesh071 2012-08-13 06:20:56

回答

0

試試這個,它爲我工作

-(void)loadHTML{ 

NSMutableString *html = [NSString stringWithFormat:@"<html><head></head><body>%@</body></html>",@"Hi"]; 
[self.tpWebView loadHTMLString:html baseURL:nil]; 

}