这里有两种方法可以考虑:
(1)更改初始控制器,即把箭头拖拽到想要创建的控制器前面,在代码中进行创建。
实现代码:
复制代码
#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];
// YYViewController *controller=[[YYViewController alloc]init];
//1.加载storyboard
UIStoryboard *storyboard=[UIStoryboard storyboardWithName:@"test" bundle:nil];
//2.创建指定的控制器
UIViewController *controller=[storyboard instantiateInitialViewController];
//3.设置控制器为Window的根控制器
self.window.rootViewController=controller;
[self.window makeKeyAndVisible];
return YES;
}
提示:注意创建的指定控制器的类型。
(2)通过设置唯一的标识符来创建指定的控制器











