Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/iphone/41.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/html/89.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Iphone 如何在UIAlertView中将html文件的文本显示为消息_Iphone_Html_Uialertview - Fatal编程技术网

Iphone 如何在UIAlertView中将html文件的文本显示为消息

Iphone 如何在UIAlertView中将html文件的文本显示为消息,iphone,html,uialertview,Iphone,Html,Uialertview,我不熟悉iPhone编程。。 我有一个html文件,里面有三行文字。 我想在消息部分的alertview中显示该文本。 为此,我们需要读取html并将数据存储在字符串中..Den使用该sting作为消息。。。 我说得对吗。。? 然后hw读取html以及如何将其存储在字符串中 请帮帮我 谢谢你 NSString*路径=[[NSBundle mainBundle]路径资源:chapter.page of type:@“html”]; NSString*content=[NSString strin

我不熟悉iPhone编程。。 我有一个html文件,里面有三行文字。 我想在消息部分的alertview中显示该文本。 为此,我们需要读取html并将数据存储在字符串中..Den使用该sting作为消息。。。 我说得对吗。。? 然后hw读取html以及如何将其存储在字符串中

请帮帮我

谢谢你

NSString*路径=[[NSBundle mainBundle]路径资源:chapter.page of type:@“html”]; NSString*content=[NSString stringWithContentsOfFile:路径编码:NSASCIIStringEncoding错误:NULL]

    UIAlertView *tAlert = [[UIAlertView alloc] initWithTitle:nil message:content delegate:self 
                                           cancelButtonTitle:nil otherButtonTitles:@"CLICK HERE", @"OR CONTINUE", @"OR BACK",nil];


    tAlert.tag=TOSChapter;

    [tAlert show];

    [tAlert release]; 
在这种情况下,它会显示html的所有标记…而不是解析html。是否有其他方法可以在alertview中显示html的内容


感谢您……

从您的资源中加载文件:

NSString *htmlPath = [[NSBundle mainBundle] pathForResource:@"yourfile" ofType:@"html"];    
NSString *content = [NSString stringWithContentsOfFile: htmlPath encoding:NSASCIIStringEncoding error:NULL];

然后,解析子字符串的HTML。

谢谢Lou Franco..快速响应。。。我应该解析以获取html中的数据吗。。。?我是否可以将此HTML文件(webView)作为子视图添加到UIAlertView。。?或者还有别的办法吗。。?再次感谢。。