views:

58

answers:

1

Hi....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 otherButtonTitles:@"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...

A: 

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.

Lou Franco
Thanks Lou Franco..for the quick response...Shold i parse to get the data in the html...?cant i add this HTML file ( webView )to the UIAlertView as a subView..?or is there any other way..?Thanks again..
rockey
I'm not sure that will work -- I guess you could try it.
Lou Franco