1.普通设置
self.window = [[UIWindow alloc] initWithFrame: [[UIScreen mainScreen]bounds]];
self.window.backgroundColor = [UIColor orangeColor];
ViewController *vc = [[ViewController alloc]init];
self.window.rootViewController = vc;
[self.window makeKeyAndVisible];
return YES;
//这样就进入ViewController中
2.创建一个导航栏
self.window = [[UIWindow alloc] initWithFrame: [[UIScreen mainScreen]bounds]];
self.window.backgroundColor = [UIColor orangeColor];
MyTableViewController *vc = [[MyTableViewController alloc]init];
UINavigationController *nvc = [[UINavigationController alloc] initWithRootViewController:vc];
self.window.rootViewController = nvc;
[self.window makeKeyAndVisible];
return YES;
//这样进去就有一个导航栏
记得包含头文件
时间: 2024-10-11 04:21:43