实现代码:
复制代码
#import "YYAppDelegate.h"
#import "YYViewController.h"
@implementation YYAppDelegate
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
self.window.backgroundColor = [UIColor whiteColor];
//1.加载storyboard
UIStoryboard *storyboard=[UIStoryboard storyboardWithName:@"test" bundle:nil];
//2.创建指定的控制器
UIViewController *controller=[storyboard instantiateViewControllerWithIdentifier:@"one"];
//3.设置控制器为Window的根控制器
self.window.rootViewController=controller;
[self.window makeKeyAndVisible];
return YES;
}
三、第三种创建方式(使用xib)
1.新建一个xib文件,命名为two.xib。
2.创建过程和注意点
(1)创建代码:
复制代码
#import "YYAppDelegate.h"











