zoukankan      html  css  js  c++  java
  • IOS 模仿有storyboard的项目控制器的创建

    ● 先加载storyboard文件(Test是storyboard的文件名)

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

    ● 接着初始化storyboard中的控制器

    ➢ 初始化“初始控制器”(箭头所指的控制器)

    NJViewController *nj = [storyboard instantiateInitialViewController];
    

    ➢ 通过一个标识初始化对应的控制器

    NJViewController *nj = [storyboard instantiateViewControllerWithIdentifier:@”nj"];

    - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
    {
       
        // Override point for customization after application launch.
        // 1.创建winodw
        self.window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds];
        // 2.创建控制器
        UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"Main" bundle:nil];
        NJViewController * vc = [storyboard instantiateInitialViewController];
        // 3.设置window的根控制器
        self.window.rootViewController = vc;
        // 4.显示window
        [self.window makeKeyAndVisible];
        
        return YES;
    }
  • 相关阅读:
    LOAD XML
    LOAD DATA
    INSERT 插入语句
    keras第一课
    android系统开发之开启启动
    Qt使用数据库
    微信订阅号案例之一
    python_install
    QtObject使用
    Qml_JS文件的使用
  • 原文地址:https://www.cnblogs.com/liuwj/p/6520073.html
Copyright © 2011-2022 走看看