UITabBarController

记住了最简单的MVC 原始模式,新的导航模式其实只是设计上做了变动.但根本的MVC 结构没变,看代码:

@property (nonatomic, strong) UIWindow *window;
@property (nonatomic, strong) FirstViewController *firstViewController;
@property (nonatomic, strong) SecondViewController *secondViewController;
@property (nonatomic, strong) UITabBarController *tabBarController;  //不需要子类化

- (BOOL) application:(UIApplication *)application
didFinishLaunchingWithOptions:(NSDictionary *)launchOptions{
// Override point for customization after application launch.
self.window = [[UIWindow alloc] initWithFrame:
[[UIScreen mainScreen] bounds]];
[self.window makeKeyAndVisible];
self.firstViewController = [[FirstViewController alloc]
initWithNibName:nil
bundle:NULL];
self.secondViewController = [[SecondViewController alloc]
initWithNibName:nil
bundle:NULL];
NSArray *twoViewControllers = [[NSArray alloc]
initWithObjects:
self.firstViewController,
self.secondViewController, nil];
self.tabBarController = [[UITabBarController alloc] init];
[self.tabBarController setViewControllers:twoViewControllers];
[self.window addSubview:self.tabBarController.view];成 // RootViewController 由tabBarController做控制.
return YES;
}


其实在Tabar的Controller中,也可以是UINavigationController



你可能感兴趣的:(mvc,null,application)