zoukankan      html  css  js  c++  java
  • iOS大神班笔记04-View的加载

    iOS开发中一个控制器创建View的过程(注意标注的地方):

    1.通过storyboard加载

    UIStoryboard的三个方法:

    + (UIStoryboard *)storyboardWithName:(NSString *)name bundle:(nullable NSBundle *)storyboardBundleOrNil;
    
    - (nullable __kindof UIViewController *)instantiateInitialViewController;
    
    - (__kindof UIViewController *)instantiateViewControllerWithIdentifier:(NSString *)identifier;
    

     实例如下:

    // name:storyboard名称不需要后缀
    
        UIStoryboard *stroyboard = [UIStoryboard storyboardWithName:@"Main" bundle:nil];
        
        // 加载sotryboard描述的控制器
        // 加载箭头指向的控制器
    
        UIViewController *vc = [stroyboard instantiateInitialViewController];
      
        UIViewController *vc = [stroyboard instantiateViewControllerWithIdentifier:@"blue"];
    

    2.通过xib加载 

    // 通过xib创建控制器
        ViewController *vc = [[ViewController alloc] initWithNibName:@"ViewController" bundle:nil];
    

        

  • 相关阅读:
    Java并发编程:线程池的使用
    Java并发(理论知识)—— 线程安全性
    grid
    grid
    grid
    grid
    grid
    grid
    grid
    grid
  • 原文地址:https://www.cnblogs.com/ming1025/p/6761982.html
Copyright © 2011-2022 走看看