【问题标题】:Removing all current animations when UIView dealloc still leaving reference当 UIView dealloc 仍然留下参考时删除所有当前动画
【发布时间】:2011-04-08 17:39:27
【问题描述】:

我有一个 UIView 子类,它在 iOS 项目中经常被分配和释放。我添加了[self.layer removeAllAnimations]; 以尝试在销毁对象之前删除所有动画。偶尔,我还是会收到-[ClassName animationDidStop:finished:]: message sent to deallocated instance。现在,不应该删除动画会杀死该委托并阻止它尝试调用 animationDidStop 吗?

【问题讨论】:

    标签: ios uiview core-animation


    【解决方案1】:

    【讨论】:

    • 我尝试这样做并将每一层的委托设置为 nil,但我仍然收到相同的错误。我还尝试循环和删除子视图,但没有成功。
    • 这是否也发生在设备上?
    • 我一直在设备上进行测试。确切地说是 iPad(第 1 代)。
    • for (CALayer *layer in [[imageLayer.sublayers copy] autorelease]) { [layer removeAllAnimations]; [层 removeFromSuperlayer];层=无; }
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2020-04-17
    • 1970-01-01
    • 1970-01-01
    • 2021-03-01
    • 2018-07-02
    • 2019-09-23
    • 2023-03-07
    相关资源
    最近更新 更多