Note that there are some explanatory texts on larger screens.

plurals
  1. POiPhone : nib file + code = mix up
    primarykey
    data
    text
    <p>I'm getting a little confused about when I should use a NIB file and when I should use code. Here's my problem :</p> <p>I have a navigation based application with a RootController and its NIB file. The RootController's NIB file contains a TableView. When I click on a cell I initialize a new connection with a request to load content. When the connection has finished loading I create a new postViewController (custom) from a NIB file and I push it on the navigationController viewController stack like that :</p> <pre><code>PostViewController *postViewController = [[PostViewController alloc] initWithNibName:@"PostViewController" bundle:[NSBundle mainBundle]]; [postViewController.webView setDelegate:self]; postViewController.postContent = [[postsData objectForKey:@"post"] objectForKey:@"content"]; [self.navigationController pushViewController:postViewController animated:YES]; [PostViewController release]; </code></pre> <p>Then, as you can see I try to set the rootViewController as the delegate for the webView in order to be able to intercept a click on a link and push a new ViewController on the stack. I need that new view to have the navigation bar with the back button.</p> <p>Problem : looks like the setDelegate isn't working because the webView:shouldStartLoadWithRequest:navigationType never gets called !</p> <p>I guess I should set the delegate in the NIB file but I have no idea how. The NIB file from PostViewController doesn't know about the RootViewController...</p> <p>Here are screenshots of the NIB files :</p> <p><img src="https://i.stack.imgur.com/KsSv8.png" alt="RootViewController.xib"></p> <p><img src="https://i.stack.imgur.com/Srdbk.png" alt="PostViewController.xib (File&#39;s Owner)"></p> <p><img src="https://i.stack.imgur.com/iLPgq.png" alt="PostViewController.xib (Web View)"></p> <p>If you need more detail just ask me.</p> <p>Thanks a lot...for helping me not banging my head for another day :)</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload