There is a class that’s a fully fledged UIViewController and when that page loads it works very nice.
I want to change how it works and rather than push on a new ViewController form my current viewcontroller, I’d rather just show this UIViewController inside a UIView on the current screen that usually launchs the new UIViewController.
This is hard to explain.
UIVC_A pushes UIVC_B onto the NavController.
Instead of having UIVC_B getting pushed onto the NavController.
I’d rather creat a UIView in UIVC_A and have UIVC_B appear inside this as a subview of UIVC_A.
What would I need to do/change to get this kind of thing working.
I tried
CVC *cv = [[CVC alloc] init];
UIView * aView = [[UIView alloc] initWithFrame:CGRectMake(100, 100, 600, 600)];
aView.backgroundColor = [UIColor blueColor];
[aView addSubview:cv.view];
[self.view addSubview:aView];
But it did not work.
CVC is a UIViewController.
Thanks,
-Code
It didn’t work because the CVC’s xib file hasn’t unarchived yet. It’s view hierarchy is available for usage after it has been loaded (the callback is -viewDidLoad).
What you need to do is programmatically load nib and use it’s contents:
and proceed as you did with the view.