通过storyboard加载视图6(4)

来源:互联网 发布:现代汉语知乎 编辑:程序博客网 时间:2024/05/20 12:51

1,添加一个storyboard



2,




3,

#import "AppDelegate.h"

#import "MainViewController.h"

@interface AppDelegate ()


@end


@implementation AppDelegate



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

    // Override point for customization after application launch.

    

    //0,创建窗口

    self.window = [[UIWindowalloc] initWithFrame:[[UIScreenmainScreen] bounds]];

    self.window.backgroundColor = [UIColorwhiteColor];

    

    

    //3,通过storyboard加载视图(优先级2

//      //添加一个storyboard,设置属性is initial view Controller

    UIStoryboard *story=[UIStoryboardstoryboardWithName:@"testStoryboard"bundle:nil];

    self.window.rootViewController=[storyinstantiateInitialViewController];

  




    

       //显示窗口

    [self.windowmakeKeyAndVisible];


    return YES;

}


0 0