如何在没有事务动画的情况下绘制图层?例如,当我设置使用CATransaction
的层的内容它工作得很好:CGContextDrawImage without Transaction动画
[CATransaction begin];
[CATransaction setValue:(id)kCFBooleanTrue
forKey:kCATransactionDisableActions];
myLayer.contents = (id)[[imagesTop objectAtIndex:Number]CGImage];
[CATransaction commit];
,但我需要从委托方法[myLayer setNeedsDisplay]
改变内容。下面是代码:
-(void)drawLayer:(CALayer *)layer inContext:(CGContextRef)context
{
CGContextDrawImage(context, rect, Image.CGImage]);
}
你是什么层的代表同样的效果? – sch 2012-02-22 16:54:58