I have my rootviewcontroller. in that I load view A.
View A containts a button to load view B. however, I don’t want to add view B as a subview of view A. which happens if I do this:
- (IBAction)loadViewB:(id)sender {
if (self.viewB == nil) {
self.viewB = [[NUMViewController alloc] initWithNibName:@"NUMviewController" bundle:Nil];
}
[self.view addSubview:viewB.view];
}
I want to load viewB as a subview of my rootview. so I can animate out viewA before animating in viewB.
but I’m not sure how I must approach this. I’m guessing I need a method in my rootViewController to handle the adding and removing of the subview. I would need to be able to call that method from within my viewA subview.
any ideas? thanks!
try
[self.view.superview addSubview:viewB.view]But I don’t think this is the best approach as it comes to MVC.
What can you do is add viewA to self.view and viewB to self.view also.