关于CALayer导致的crash问题
来源:互联网 发布:apache是什么网络模型 编辑:程序博客网 时间:2024/04/28 20:49
在使用层来手动绘制视图时,如果有添加子层,并且希望使用使用
-(void) drawLayer: (CALayer*) layer inContext: (CGContextRef) context
来自己用代码绘制视图时,注意不要设置其delegate为uiview类型实例。会导致程序crash。
关于这一点,苹果官方在文档中已有说明。解决办法:
he lightest-wight solution would be to create a small helper class in the the file as the UIView that's using the CALayer:
In MyView.h
@interface MyLayerDelegate : NSObject. . .@end
In MyView.m
@implementation MyLayerDelegate- (void)drawLayer:(CALayer*)layer inContext:(CGContextRef)ctx{. . .}@end
Just place those at the top of your file, immediately below the #import directives. That way it feels more like using a "private class" to handle the drawing (although it isn't -- the delegate class can be instantiated by any code that imports the header).
- 关于CALayer导致的crash问题
- 关于CALayer导致的crash问题
- 关于iOS10 获取权限导致Crash问题的解决办法
- RapidXML 导致的 crash 问题
- VirtualProtect导致程序crash的问题。
- unbindService()导致应用Crash的问题
- Android 7.0 广播导致的crash问题
- 关于Crash文件的问题
- android ndk空指针导致CRASH的问题
- 一些Windows API导致的Crash以及使用问题总结
- 一些Windows API导致的Crash以及使用问题总结
- iOS 7.0 使用定位requestAlwaysAuthorization导致crash的问题
- 关于server crash问题的探索
- implicit declaration 导致的crash
- [CALayer release] crash
- 关于.so库文件引入项目导致crash的若干问题总结
- 关于CALayer的学习笔记
- 关于CALayer的Content属性
- mysql数据库创建,表创建,插入数据
- oracle 查看启动时间和运行时间
- 黑莓,你是否将要步诺基亚的后尘?
- Java WEB 项目架构
- Sample大全
- 关于CALayer导致的crash问题
- .sql索引的填充因子多少最好,填充因子有什么用
- mysql导入数据时 USING BTREE 错误解决办法
- 网络测量算法
- Entity Framework快速入门--IQueryable与IEnumberable的区别
- usaco Barn Repair
- gbk2utf-8dir.sh
- EXT textfield 添加鼠标事件
- android从网络获取图片以及异步加载图片