关闭

iOS程序初始化

394人阅读 评论(0) 收藏 举报
分类:

1. 先初始化self.window

2. self.viewController

3. self.window.rootViewController

4. 显示, [self.window makeKeyAndVisible]


- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions

{

    self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];

    // Override point for customization after application launch.

if ([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPhone) {

    self.viewController = [[OTViewController alloc] initWithNibName:@"OTViewController_iPhone" bundle:nil];

} else {

    self.viewController = [[OTViewController alloc] initWithNibName:@"OTViewController_iPad" bundle:nil];

}

self.window.rootViewController = self.viewController;

    [self.window makeKeyAndVisible];

    return YES;

}

0
0

查看评论
* 以上用户言论只代表其个人观点,不代表CSDN网站的观点或立场
    个人资料
    • 访问:48502次
    • 积分:1044
    • 等级:
    • 排名:千里之外
    • 原创:53篇
    • 转载:15篇
    • 译文:5篇
    • 评论:0条
    文章分类