-[UIView addSubview:]
causes the subview to be retained, and -[UIView removeFromSuperview]
causes the view to be released. This is direct from Apple's UIView documentation. At that point, one of your objects needs to retain the CALayer or it will be deallocated.
I assumed that the CALayer was created by you directly. All UIViews are associated with CALayers; the CALayer is what a UIView draws into, and then its CALayer is composited onto the screen. If you're not working with CALayers directly, this is a symptom of another problem.
The core problem you're describing is an overrelease. It's possible you're not retaining a UIView when you should. I suggest you run the Xcode analyzer (in Xcode 4, choose the Product > Analyze) menu item and see what gets reported. Pay special attention to all of the memory management errors it reports.
相关推荐
CALayer指南了解CALayer的财产。
图层CALayer的一些知识:自定义图层,图层的一些动画
CALayer基本使用,CALayer基本使用,CALayer基本使用,CALayer基本使用
CALayer 图层处理
这是我自己写的一个关于CALayer的基本使用的代码,需要学习的朋友可以下载看看。以后会陆续上传一些CALayer的高级使用,主要是核心动画方面的内容。
CALayer-AutoresizingMask 为 iOS CALayer 添加 UIViewAutoresize 支持和快速 UIView 到 CALayer 的转换方法 安装 pod 'CALayer-AutoresizingMask' 用法 不要在这个storyboard或XIB使用自动布局,并使用您需要的...
#QCAR-CALayer 使用 Vuforia AR 引擎 使用不同的方法来显示 2D-AR 元素 QCARWebViewController 使用 UIWebView QCARCALayerViewController 使用 CALayer
CALayer的子类.zip
这是我在学习ios的过程中写的一个demo,介绍了CALayer的简单使用。
通过自定义CALayer,实现星空模拟效果(当然效果一般般)。代码很简单,都在CMLayer类中,仅为大家自定义CALayer并添加相关动画提供一份参考demo。
原理:使用CALayer 实现时钟 文章:https://kunnan.blog.csdn.net/article/details/74135552
简单方便的间接实现CALayer的"AutoLayout
##用法CALayer 属性动画想象以下旋转动画: var rotation = CABasicAnimation ( keyPath : " transform.rotation.z " )rotation. fromValue = 0rotation. toValue = M_PI * 2.0rotation. duration = 2self . ...
用代码实现三维立体图形
iOS CALayer 思维导图,超级棒棒哒 iOS CALayer 思维导图,超级棒棒哒
传入百分比参数,实现进度条变化,用于下载网络资源时,下载量占总量的多少
NULL 博文链接:https://hulefei29.iteye.com/blog/1155377
iOS CALayer动画实现
利用 CALayer 可以实现复杂的动画效果,同时 CALayer 在运动过程中,需要点击 CALayer,同时能够监控到点击的对象
CAlayer层的隐式动画属性