I have an iPad master-detail where the main detail controller is a navigation controller and depending on the table row (in the master view controller) selected, I may or may not replace the view controller managed by the detail navigation controller.
This seems to work fine, except that I lose access to the new detail view controller's IBOutlets when this move is made.
Here's me switching the navigation controller's view controller:
CustomerDetailViewController *subview = [[CustomerDetailViewController alloc] initWithNibName:@"CustomerDetailViewController" bundle:nil];
[subview setTitle:@"Testing"];
AppDelegate *app = (AppDelegate *)[[UIApplication sharedApplication] delegate];
app.splitViewController.delegate = subview;
[app.detailNavigationController setViewControllers:[NSArray arrayWithObjects:subview, nil]];
[subview setData:[custData objectForKey:@"name"]];
custData is an NSDictionary containing my view information. Here is the setData command:
- (void)setData:(NSDictionary *)cust {
NSLog(@"%@\n", [cust valueForKey:@"name"]);
self.nameLabel.text = [cust valueForKey:@"name"];
NSLog(@"%@\n", self.nameLabel.text);
}
So what happens is, subview becomes the new view controller but the label does not get changed - however, those two log commands are executed. The label is synthesized and wired up using IB and works if I push subview as a new view controller instead of replace it.