天天看點

storyboard取得視圖控制器

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions

{

    // Override point for customization after application launch.

    self.window = [[UIWindow alloc]initWithFrame:[[UIScreen mainScreen]bounds]];

    self.window.backgroundColor = [UIColor redColor];

    UIStoryboard *storyboard=[UIStoryboard storyboardWithName:@"Main" bundle:nil];

    //2.下面這個方法代表着建立storyboard中箭頭指向的控制器(初始控制器)

    ViewController *controller=[storyboard instantiateInitialViewController];

    self.window.rootViewController = controller;

   [self.window makeKeyAndVisible];

    return YES;

}