佚名通过本文主要向大家介绍了drawlayer,ios,ios10.3.3,ios模拟器电脑版,ios模拟器等相关知识,希望对您有所帮助,也希望大家支持linkedu.com www.linkedu.com
问题: iOS执行drawLayer:incontext,pop操作后闪退
描述:
解决方案1:
描述:
看CA教程,执行完drawLayer后闪退,demo如下
-(void)drawLayer:(CALayer *)layer inContext:(CGContextRef)ctx{
//线宽
CGContextSetLineWidth(ctx, 10.0f);
//线颜色
CGContextSetStrokeColorWithColor(ctx, [UIColor greenColor].CGColor);
//画椭圆
CGContextStrokeEllipseInRect(ctx, layer.bounds);
}
是需要释放指针咩?
解决方案1:
问题出在layer.delegate
添加这个
(void)dealloc {
yourLayer.delegate = nil;
}
另外关于layer delegate苹果的说明
http://stackoverflow.com/questions/2015353/using-calayer-delegate