#import <UIKit/UIKit.h>
#import "UCMapviewController.h"
#import "UCMenuviewController.h"
#import "UCOverviewController.h"
@interface UCRootViewController : UIViewController
@property (strong, nonatomic) UCMapviewController *mapviewController;
@property (strong, nonatomic) UCMenuviewController *menuviewController;
@property (strong, nonatomic) UCOverviewController *overviewController;
This is my rootviewController which does not display anything himself, he is just responsible for presenting the other view controllers when needed (later becoming the delegate of those controllers).
So my question is, do I have to implement a view for this rootviewController? I’ve read the ViewController programming guide, but I couldn’t find an answer to this.
For what I know, the rootviewController makes another controller appear with their own view which then will take over the space. Is this the wrong approach?
thank you
Normally I manage my rootViewController in the app delegate in subtle way. For instance, in an application with a Login
UIViewController, I will present the rest of theUIViewControllersfrom that Login View Controller, using, for example,presentModalViewController. But having a rootViewController that handles yourUIViewControllersfor you it’s not a bad approach, as long as you remember some details (for that I would recommend you reading this). There is also a good WWDC view about containers. 🙂Edit 1:
1) MVC is probably the most used pattern in iOS. It’s difficult not to use it, when developing for iOS, but it takes some experience to correctly implement it
2) Yes you don’t need it. You can use the AppDelegate for it, by playing with the
window.rootViewController3) Model is the logic part of your application, plus the data source. Normally, you would have 2 layers: logic and data access. In the model part, you englob both. The controller makes the bridge between the View (what the user sees) and the model, the logic and data that is processed under the hood. You can think of the Xib’s as the Views, the
UIViewControllersas the controllers, and the rest of the classes that “fuel” yourUIViewControllersas the model.