zoukankan      html  css  js  c++  java
  • Storyboard & XIB 自己的理解

    //1.storyboard的加载方式

        //(1)

        //此处bundle:nil 等价于 [NSBundle mainBundle]

     //    SecondViewController *secondVc = [[UIStoryboard storyboardWithName:@"Main" bundle:nil]instantiateViewControllerWithIdentifier:@"Second"];
    
        //    SecondViewController *secondVc = [[UIStoryboard storyboardWithName:@"Main" bundle:[NSBundle mainBundle]]instantiateViewControllerWithIdentifier:@"Second"];

        //(2)

    //SecondViewController *secondVc = [[UIStoryboard storyboardWithName:@"SecondSB" bundle:nil]instantiateViewControllerWithIdentifier:@"Second"];

        //(3)

    //    SecondViewController *secondVc = [[UIStoryboard storyboardWithName:@"SecondSB" bundle:nil]instantiateInitialViewController];

        //2.与控制器同名的XIB文件 SecondViewController.xib init或initWithNibName加载

       

     //(1)
    
        //    SecondViewController *secondVc = [[SecondViewController alloc]init];
    
        //(2)
    
        //    SecondViewController *secondVc = [[SecondViewController alloc]initWithNibName:@"SecondViewController" bundle:nil];

        //3.与控制器不同名的XIB文件 View.xib loadNibNamed加载控制器的view

        /*

         在创建控制器的时候直接指定要加载xib作为控制器的view,名称不相干

         > 需要修改xib文件的fileOwner进行关联

         > 需要将fileOwner里面的view指向xib里面的view

         */

       

     //(1)initWithNibName---注重file owner
    
        SecondViewController *secondVc = [[SecondViewController alloc]initWithNibName:@"Second" bundle:nil];
    
        //(2)
    
        //    SecondViewController *secondVc = [[SecondViewController alloc]init];
    
        //    secondVc.view = [[[NSBundle mainBundle]loadNibNamed:@"SecondViewController" owner:nil options:nil] lastObject];

        //4.与控制器不同名的XIB文件 删除View,创建控制器  loadNibNamed---注重xib中内容

      

      //    SecondViewController *secondVc = [[[NSBundle mainBundle]loadNibNamed:@"SecondVC" owner:nil options:nil] lastObject];
  • 相关阅读:
    监控LVS
    技巧:结合Zabbix与SNMP监控嵌入式设备
    Vmware Exsi使用简要说明
    (转)Linux LVM逻辑卷配置过程详解(创建、扩展、缩减、删除、卸载、快照创建)
    Linux系统下减少LV(逻辑卷)容量
    Linux系统下增加LV(逻辑卷)容量 、Linux系统下减少LV(逻辑卷)容量
    yarn命令删除job
    mr自定义排序和分类
    mr利用shuffle阶段来实现数据去重的功能
    hadoop如何使用第三方依赖jar包(转载)
  • 原文地址:https://www.cnblogs.com/guchunli/p/6233956.html
Copyright © 2011-2022 走看看