1. 新建一个Empty项目
2. 新建一个UIViewController的子类,命名为ViewController,生成的对应文件为ViewController.h, ViewController.m及ViewController.xib
3. 确认工程TAGETS中的Main interface为空
4. 打开AppDelegate.m文件,添加头文件#import "ViewController.h",在application:didFinishingLaunchingWithOptions:函数添加如下代码:
self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]]; ViewController *myViewController = [[ViewController alloc] initWithNibName:@"ViewController" bundle:nil]; self.window.rootViewController = myViewController; [self.window makeKeyAndVisible];
时间: 2024-10-09 23:06:02