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;
    }
  • 相关阅读:
    golang语法要点笔记
    环境配置
    实现chrome多用户独立cookie
    Golang遇到的问题记录
    php preg_replace去除html xml 注释
    C 基础
    多种写法
    mysql 查看当前数据库
    sql group by
    sql CONCAT()
  • 原文地址:https://www.cnblogs.com/liuwj/p/6520073.html
Copyright © 2011-2022 走看看