首页 > 代码库 > XIB文件链接controller文件&&加载rootviewcontroller

XIB文件链接controller文件&&加载rootviewcontroller

1.定义好的xib文件rootView.xib,选中files·owners  在class中选择对应的viewController

2.如何在window中指定rootViewController

------在appdelegate.h中声明属性

 @property (strong,nonatomic)rootViewController* rvc;

------在appdelegate.m中的didFinishLauchingWithOptions:方法中加载rvc

self.rvc = [[rootViewController alloc]initWithNibName:@"rootView" bundle:nil]; //rootView是rootView.xib文件的名字

self.window.rootViewController = rvc;

//显示window

[self.window makeKeyAndVisible]; 
return YES;