I've got a View that appears as a dialog and I am animating its opacity when I want it to be removed from the parent view.
I'm using the following code to change its opacity via a CABasicAnimation:
CALayer *opacityOutLayer = sheetView.layer;
CABasicAnimation *fadeOutAnimation = [CABasicAnimation animationWithKeyPath:@"opacity"];
fadeOutAnimation.fromValue = [NSNumber numberWithFloat:1.0];
fadeOutAnimation.toValue = [NSNumber numberWithFloat:0.0];
fadeOutAnimation.duration = 0.255;
[opacityOutLayer addAnimation:fadeOutAnimation forKey:@"opacity"];
This looks perfect in the simulator, but not very smooth on a device. Is there any way to cache the animation (like using UIView transition cache:YES)?
I'm sure this is pretty simple but after searching the documentation and CALayer class info I can't find anything to cache it.