1,//添加一个xib,设置控制器MainViewController,然后右击file‘s owner,关联view到xib的view
2,
#import "AppDelegate.h"
#import "MainViewController.h"
@interface AppDelegate ()
@end
@implementation AppDelegate
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
// Override point for customization after application launch.
//0,创建窗口
self.window = [[UIWindowalloc] initWithFrame:[[UIScreenmainScreen] bounds]];
self.window.backgroundColor = [UIColorwhiteColor];
//4,通过xib显示视图(优先级3)
//添加一个xib,设置控制器MainViewController,然后右击file‘s owner,关联view到xib的view
MainViewController *addxib=[[MainViewController alloc]initWithNibName:@"test" bundle:nil];
self.window.rootViewController=addxib;
//显示窗口
[self.windowmakeKeyAndVisible];
return YES;
}