PDA

View Full Version : Displaying html files in detailView from resource folder




lafhog
Aug 12, 2011, 04:22 AM
I am using plist to load the tableview, which works fine, then i have a directory of html files in resources, now i need to load each file when selected in tableView, into a webView which is in detailView,
any help would be greatly appreciated,

- (void)setDetailItem:(id)newDetailItem {
if (detailItem != newDetailItem) {
[detailItem release];
detailItem = [newDetailItem retain];


// Update the view.
navigationBar.topItem.title = [detailItem description];

}


if (popoverController != nil) {
[popoverController dismissPopoverAnimated:YES];
}

}

- (void)viewDidLoad {
[super viewDidLoad];


NSString *urlAddress =[[NSBundle mainBundle] pathForResource:@"Cars" ofType:@"html"inDirectory:@"Cars"];
NSURL *url = [NSURL URLWithString:urlAddress];
NSURLRequest *requestObj = [NSURLRequest requestWithURL:url];
[webView loadRequest:requestObj];}



KoolStar
Aug 15, 2011, 04:54 AM
What specifically is not working?

PhoneyDeveloper
Aug 15, 2011, 07:07 AM
To create NSURLs that point to files in the file system you need to use [NSURL fileURLWithPath:path]