I have a high level controller class that is in charge of managing several classes and driving a state machine.
Part of the state logic involves the temporary display of a couple of different screens, there is a dedicated view controller for each of these screens and the high level controller creates these other controller classes and presents them as modal view controllers as necessary.
However one of these view controllers is very simple, it has a button and some text which can change as the state progresses. The high level controller is the class that knows what text to display at what stage and also it needs to know when the button has been pressed.
Therefore the view controller would need to present an API which the high level controller can call to set the text, and also the high level controller would need to be a delegate of the view controller so it can be called back when the button is pressed. This seems unnecessary plumbing which I'd like to remove.
So I could move the outlets and actions in the view controller into the high level controller so this plumbing isn't needed. But then there's nothing left in the view controller (its being instantiated from a nib). So I'd like to get rid of it entirely.
Then once its gone I was planning on having this in the high level controller:
UIViewController *vc = [[UIViewController alloc] initWithNibName:@"TheNib" bundle:nil];
or should it be:
UIViewController *vc = [[UIViewController alloc] init];
[[NSBundle mainBundle] loadNibNamed:@"TheNib" owner:vc options:nil];
[[UIApplication sharedApplication].delegate.window.rootViewController presentViewController: self.vc animated: NO completion:nil];
However how should IB be set up in order to achieve this - specifically a) what should the File's Owner be set to? b) what can the view within the IB be set to?
Note that the high level controller is already inheriting from another class and thus I cannot derive it from UIViewController thus it does not have a view property to connect to the view in IB.
Is there a easy way of connecting the xib contents to the UIViewController that is created within the high level view controller?