Search code examples
iosuitableviewdetailsview

How to pass a plist string (html file name) via table view to detailviewcontroller's webview?


I have been fllowing this example

http://nscookbook.com/2013/02/ios-programming-recipe-13-using-property-lists-plists/

I am stuck!


Solution

  • Create a property in your detailViewController, in my case it's webViewController.

    @property (nonatomic, strong) NSString *urlString;
    

    When your tableView cell is clicked, pass your plist string to your detailViewController, by setting this property. Sample code:

      WebViewController *webViewController = [WebViewController new];
      webViewController.urlString = urlString;
      [self.navigationController pushViewController:webViewController animated:YES];
    

    That's all, now your detailViewController knows this passed string.