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;
    }
  • 相关阅读:
    C#如何取硬件标志
    在C#中利用Excel做高级报表
    C#实现网段扫描
    用C#编写一个抓网页的应用程序
    C# 中操作API
    C#串口操作
    C#里的InputBox
    使用C#进行Word 2002和Excel 2002编程
    用C#快速往Excel写数据
    postgres 查看数据库大小
  • 原文地址:https://www.cnblogs.com/liuwj/p/6520073.html
Copyright © 2011-2022 走看看