1. Welcome to the new MacRumors forums. See our announcement and read our FAQ

Displaying html files in detailView from resource folder

Discussion in 'iPhone/iPad Programming' started by lafhog, Aug 12, 2011.

  1. lafhog, Aug 12, 2011
    Last edited by a moderator: Aug 12, 2011

    macrumors newbie

    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];}
  2. macrumors demi-god


    What specifically is not working?
  3. macrumors 68030


    To create NSURLs that point to files in the file system you need to use
    [NSURL fileURLWithPath:path]

Share This Page