It's driving me crazy! I am working on a drawing application. Let's say I am working on a UIView
called sheet.
I am adding some sublayers to this view ([sheet.layer addSublayer:...]
) and then I want to draw into them. To do so I am creating a CGImageRef
and putting it into the layer's contents
. But it's animated and I don't want that.
I tried everything:
removeAnimationForKey:
removeAllAnimations
delegate
[CATransaction setDisableAnimations:YES]
It's seems correct. I don't understand why this layer is still animated ;_;
Am I doing something wrong? Is there a secret way?
You have to explicitly disable animations by wrapping your code in a CATransaction
[CATransaction begin];
[CATransaction setValue:(id)kCFBooleanTrue
forKey:kCATransactionDisableActions];
layer.content = someImageRef;
[CATransaction commit];