I’m getting a little confused about when I should use a NIB file and when I should use code.
Here’s my problem :
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 :
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];
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.
Problem : looks like the setDelegate isn’t working because the webView:shouldStartLoadWithRequest:navigationType never gets called !
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…
Here are screenshots of the NIB files :



If you need more detail just ask me.
Thanks a lot…for helping me not banging my head for another day 🙂
[postViewController.webView setDelegate:self];sets the delegate for the current Controller notpostViewController. Try:And you can put this line below
pushViewController:animated:then the webView should already exist.