MyViewController.xib has File's Owner class set to MyViewController
(a subclass of UIViewController
) and File's Owner view connected to a UIView
containing some subviews.
OtherViewController.xib has File's Owner class set to UIViewController
and File's Owner view connected to an empty UIView
.
Is it possible in Interface Builder to embed MyViewController
's view inside the view in OtherViewController.xib?
I tried adding an instance of MyViewController
into OtherViewController.xib, but I can't drop it inside the view (because it's not a UIView
) and I can't get to the view that was associated with MyViewController
in MyViewController.xib (only the view controller itself, and nothing it's connected to, makes it over to OtherViewController.xib).
Best Answer
You probably do not want to do this. Follow the warning in the View Controller Programming Guide:
A UIViewController subclass whose view does not fill the window will not behave as you might expect. It will not receive view controller lifecycle messages, rotation messages, or have its
parentView/navigation/tabBarController
properties set correctly.A UITableViewCell should not be the view for a UIViewController. It might have some controller object responsible for managing its behavior (though I suspect this behavior can probably all be contained within the cell view itself) but that controller should not inherit from UIViewController.