zoukankan      html  css  js  c++  java
  • IOS storyboard(控件器的 生命周期)

    @interface NJTwoViewController ()
    
    @end
    
    @implementation NJTwoViewController
    
    // 当控制器的view加载完毕就调用
    - (void)viewDidLoad
    {
        [super viewDidLoad];
        NSLog(@"Two -  viewDidLoad");
    }
    
    // 控制器即将显示的时候调用
    - (void)viewWillAppear:(BOOL)animated
    {
        [super viewWillAppear:YES];
        NSLog(@"Two -  viewWillAppear");
    }
    
    // 控制器完全显示的时候调用
    - (void)viewDidAppear:(BOOL)animated
    {
        [super viewDidAppear:animated];
        NSLog(@"Two -  viewDidAppear");
    }
    
    // 控制器即将消失的时候调用
    - (void)viewWillDisappear:(BOOL)animated
    {
        [super viewWillDisappear:animated];
        NSLog(@"Two -  viewWillDisappear");
    }
    // 控制器完全消失的时候调用
    - (void)viewDidDisappear:(BOOL)animated
    {
        [super viewDidDisappear:animated];
        NSLog(@"Two -  viewDidDisappear");
    }
    View Code
    @interface NJOneViewController ()
    
    @property (nonatomic, strong) NSArray *foods;
    @end
    
    @implementation NJOneViewController
    
    // 当控制器的view加载完毕就调用
    - (void)viewDidLoad
    {
        [super viewDidLoad];
        NSLog(@"One -  viewDidLoad");
    }
    
    // 控制器的view即将显示的时候调用
    - (void)viewWillAppear:(BOOL)animated
    {
        [super viewWillAppear:YES];
        NSLog(@"One -  viewWillAppear");
    }
    
    // 控制器的view完全显示的时候调用
    - (void)viewDidAppear:(BOOL)animated
    {
        [super viewDidAppear:animated];
        NSLog(@"One -  viewDidAppear");
    }
    
    // 控制器的view即将消失的时候调用
    - (void)viewWillDisappear:(BOOL)animated
    {
        [super viewWillDisappear:animated];
        NSLog(@"One -  viewWillDisappear");
    }
    // 控制器的view完全消失的时候调用
    - (void)viewDidDisappear:(BOOL)animated
    {
        [super viewDidDisappear:animated];
        NSLog(@"One -  viewDidDisappear");
    }
    
    // 控制器的view即将销毁的时候调用
    - (void)viewWillUnload
    {
        [super viewWillUnload];
    }
    // 控制器的view完全销毁的时候调用
    - (void)viewDidUnload
    {
        [super viewDidUnload];
        // 清空不需要的属性
    //    [self.foods release];
        self.foods = nil;
    }
    
    //- (void)setFoods:(NSArray *)foods
    //{
    //    if (_foods != foods) {
    //        [foods release];
    //        _foods = [foods retain];
    //    }
    //}
    
    // 接收到内存警告的时候调用
    - (void)didReceiveMemoryWarning
    {
        [super didReceiveMemoryWarning];
        // Dispose of any resources that can be recreated.
        // NSLog(@"One  didReceiveMemoryWarning");
    }
     /**/
  • 相关阅读:
    域账户-配置文件
    创建任务计划
    查看系统和PowerShell版本
    查找数组中元素的索引位置
    更改计算机名称,修改密码
    生成GUID
    微服务架构 vs. SOA架构
    springMvc架构简介
    Spring Boot和Spring cloud
    Spring链接汇总
  • 原文地址:https://www.cnblogs.com/liuwj/p/6520184.html
Copyright © 2011-2022 走看看