Reputation: 19
I have a locally stored .htm file and I want to pull the raw html string and display it a textview. I know how to display strings in textviews and everything else, I just need to know how to get the inner strong from the locally stored .htm file. Right now all I can pull is the path.
Upvotes: 0
Views: 1519
Reputation: 172
First, you'll have to add the file to your project and include it in the application bundle:
This makes sure the file is available when your application runs on the device.
To read the content of the file when your application runs, get the file path:
NSString *path = [[NSBundle mainBundle] pathForResource:@"your_file" ofType:@"htm"];
and then load the file
NSError *error;
NSString *content = [NSString stringWithContentsOfFile:path encoding:NSUTF8StringEncoding error:&error];
Things to watch out for:
Upvotes: 2