m
@implementation AppDelegate - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]]; // Override point for customization after application launch. self.window.backgroundColor = [UIColor whiteColor]; [self.window makeKeyAndVisible]; // 窗户在工程创建好就存在了 我需要创建程序的第一个页面并且添加到窗户上 //创建第一个页面 FirstViewController* first =[[FirstViewController alloc]init]; //添加到窗户上(指定根视图) self.window.rootViewController=first; return YES; }
FirstViewController m
@implementation FirstViewController - (void)viewDidLoad { [super viewDidLoad]; //更改背景颜色 self.view.backgroundColor=[UIColor yellowColor]; }