看CA教程,执行完drawLayer后闪退,demo如下
-(void)drawLayer:(CALayer *)layer inContext:(CGContextRef)ctx{
//线宽
CGContextSetLineWidth(ctx, 10.0f);
//线颜色
CGContextSetStrokeColorWithColor(ctx, [UIColor greenColor].CGColor);
//画椭圆
CGContextStrokeEllipseInRect(ctx, layer.bounds);
}
是需要释放指针咩?
问题出在layer.delegate
添加这个
(void)dealloc {
}
另外关于layer delegate苹果的说明
http://stackoverflow.com/questions/2015353/using-calayer-delegate