【问题标题】:XCODE, dealloc called only after removeFromSuperViewXCODE,dealloc 仅在 removeFromSuperView 后调用
【发布时间】:2016-10-05 11:41:54
【问题描述】:

我有自定义视图的 xib、h 和 m 文件,UIView 的子类。我将此自定义视图添加到 UIVIewControlloer 的视图中。但是当我打电话时

[self.navigationController popViewControllerAnimated:YES];

UIViewController 的 dealloc 方法调用,但 dealloc 方法 os 自定义视图 - 不是。如果我从控制器的视图中删除自定义视图(removeFromSuperview), 两种方法都调用。我不知道为什么...

【问题讨论】:

    标签: xcode dealloc


    【解决方案1】:

    自定义类中的 In 方法作为强参数传递给 UIView。改为weak,现在一切正常。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2012-09-07
      • 1970-01-01
      • 1970-01-01
      • 2011-12-06
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多