zoukankan      html  css  js  c++  java
  • 控制器的创建方式 -- 及其导航控制器的管理

    • 一 控制器的创建方式

    1、storyboard创建

     1 self.window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds];
     2     
     3     self.window.backgroundColor = [UIColor blueColor];
     4    
     5     UIStoryboard *story = [UIStoryboard storyboardWithName:@"Main" bundle:nil];
     6     
     7 //    SDoneViewController *vc = [story instantiateInitialViewController];
     8     
     9     SDoneViewController *VC1 = [story instantiateViewControllerWithIdentifier:@"two"];
    10     
    11     self.window.rootViewController = VC1;
    12     
    13     
    14     [self.window makeKeyAndVisible];
    15     
    16     return YES;

    2、直接创建控制器

        self.window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds];
        
        self.window.backgroundColor = [UIColor blueColor];
    
        SDoneViewController *vc = [[SDoneViewController alloc] init];
        
        self.window.rootViewController = vc;
        
        
        [self.window makeKeyAndVisible];
        
        return YES;

    3、通过XIB创建控制器

    elf.window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds];
        
        self.window.backgroundColor = [UIColor blueColor];
       
        SDThreeViewController *three = [[SDThreeViewController alloc] initWithNibName:@"three" bundle:nil];
        
        self.window.rootViewController = three;
        
        
        [self.window makeKeyAndVisible];
        
        return YES;
     
  • 相关阅读:
    1343. Fairy Tale
    Codeforces Beta Round #97 (Div. 1)
    URAL1091. Tmutarakan Exams(容斥)
    1141. RSA Attack(RSA)
    hdu4003Find Metal Mineral(树形DP)
    hdu2196 Computer待续
    KMP
    莫比乌斯反演
    配对堆
    bzoj3224Treap
  • 原文地址:https://www.cnblogs.com/ndyBlog/p/4005410.html
Copyright © 2011-2022 走看看