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;
}
iOS应用启动配置
本文介绍如何在iOS应用中使用xib文件配置MainViewController,并通过AppDelegate完成应用启动时的视图加载过程。

被折叠的 条评论
为什么被折叠?



