0

次の方法を使用して、ウェブサイトからhtmlをロードしています

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

NSString *str=@"<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];

}

残念ながら、webviewに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文字列をロードして、私が間違っていることを助けてください

4

1 に答える 1

0

これを試してください、それは私のために働きます

-(void)loadHTML{

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

}

于 2012-08-13T06:18:06.250 に答える