zoukankan      html  css  js  c++  java
  • UIViewController卸载过程(ios6.0以后)

      在ios6.0以后,废除了viewWillUnload方法和viewDidUnload方法。

      在ios6以后,当收到didReceiveMemoryWarning消息调用之后,程序会自动调用didReceiveMemoryWarning函数,重写父类的- (void)didReceiveMemoryWarning函数:

     1 - (void)didReceiveMemoryWarning
     2 {
     3     [super didReceiveMemoryWarning];
     4     
     5     //拿到应用程序的窗口
     6     if ([self.view window] == nil) {
     7         //释放视图拥有的强引用view实例
     8         //......如:self.subView = nil;
     9         self.view = nil;
    10     }  
    11 }

    在ios6.0之前,自动会释放UIViewController实例的根视图view,但是6.0之后,需要手动释放没有显示的控制器的view。也可以在里面释放大量的图片数据。

    重写dealloc方法,执行最后的清理工作,注:其它属性会自动释放,不需要手动释放。

  • 相关阅读:
    rsync
    typora 页内跳转
    shell脚本搭建redis集群
    Html
    python json模块
    Appium
    selenium+python
    jmeter+ant+jenkins接口自动化测试框架
    测试小结
    面向对向
  • 原文地址:https://www.cnblogs.com/hereiam/p/3788461.html
Copyright © 2011-2022 走看看