views:

258

answers:

1

I'm trying to essentially re-implement the UISplitViewController (because it has its limits), but when I create a UIViewController viewController, and then do an "[viewController.view addSubview contentViewController.view]" on it, to add a view that already has a view controller, that content view doesn't seem to get initialised by its view controller. I guess its view controller is getting detached or deallocated, is this the case?

A: 

Can you post your code?

UIViewController* myController = [[UIViewController alloc] initWithNibName:@"myView" bundle:nil];
myViewClass* cellView = (myViewClass*)cellController.view;
[self addSubview:cellView];

The above code will add a subview using the view in the "myView" nib.

Ensure that in the nib file - The view is of myViewClass the File's Owner is UIViewController and its view outlet is connected to the view.

Bharat Ahluwalia