开发者

How to display the text of an html file in UIAlertView as a message

i am new to iPhone programming.. i have an html file..in that 3 lines of text is there. i want to display that text in alertview in the message part. for this we need to read the html and store the data in a string..Den use that sting as a message... am i right..? then hw to read the html and how to store that in a string..?

please help me out

Thank u ......

NSString *path = [[NSBundle mainBundle] pathForResource:chapter.page ofType:@"html"]; NSString *content = [NSString stringWithContentsOfFile: path encoding:NSASCIIStringEncoding error:NULL];

    UIAlertView *tAlert = [[UIAlertView alloc] initWithTitle:nil message:content delegate:self 
                                           cancelButtonTitle:nil otherButtonTitl开发者_如何学Goes:@"CLICK HERE", @"OR CONTINUE", @"OR BACK",nil];


    tAlert.tag=TOSChapter;

    [tAlert show];

    [tAlert release]; 

in this its displaying all the tags of html...instead of parsing the html is there any other way to display the content of html in alertview..?

Thank u...


To load the file from your resources:

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

Then, parse the HTML for your substrings.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜