Hi,
So honestly I might just be thinking about this entire situation incorrectly, so if you think that's the case please say so, I would like some input.
(I am not using a TabBarController because it's not right for this particular app.)
In my app, I have three separate views with their own view controller, each as a subclass of UIViewController. I also have one view and view controller that acts as sort of a god class, that contains outlets and actions that allow the other views to be loaded. In my app delegate's viewdidload, I call
Code:
[window addSubview:viewController.view];
[window makeKeyAndVisible];
So the application launches, and it loads the view of the "god" view controller. This view contains a button, and when it is pressed, I want it to load a different view controller's view. I was able to do this successfully, by using
Code:
[self clearView];
[self.view insertSubview:firstView.view atIndex:1];
where clearView is a self contained action that just removes the god view controllers view from the superview.
On the "firstView.view" I have a button that calls an action within firstView's view controller, that goes back to the "god" view controller's view. This is all working correctly, even if I feel like it's not the best way of doing this.
So my question is, in terms of indirection and object oriented programming, is there a way to essentially make the firstView's, secondView's, and thirdView's view controller a subclass of the god view controller, so that from within for instance firstView's view controller, I can call an action or access a property that exists in the god view controller?
My goal is to use the god view controller to do handle all of the switching of views, but then use those other view's view controller's to handle what is going on in their respective views.
An example would be, from the firstView view controller, to call an action "loadSecondView" that exists in the god view controller. What is the best way to do this, if at all?
Again, if I am approaching this whole scenario wrong, say so. I will take any input that I can get!