#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