切换根视图控制器

#import "RootViewController.h"

一.引入

#import "AppDelegate.h"

二.签代理

@interface RootViewController ()<UIApplicationDelegate>

@end

@implementation RootViewController

 

- (void)viewDidLoad {

    [super viewDidLoad];

 

    //   1.获取当前应用程序

UIApplication *app = [UIApplication sharedApplication];

 

    //   2.创建一个UIViewControler的对象,并把它设置为委托

    AppDelegate *app2 = app.delegate;

 

    //  3.最后就可以设置根视图控制器了

XXViewController *xx = [[XXViewController alloc]inint]

    app2.window.rootViewController = xx;

}

 @end

 

posted on 2017-03-01 14:51  开花结果乐园  阅读(116)  评论(0编辑  收藏  举报

导航