I wish to remove a CALayer from its superlayer without animating. What happens here is the layer animates to a position, works great, when however the animation stopped, this code is executed, which returns the layer to its start position, and fades out; presumably then gets removed from the superlayer. How may it be stopped from animating -removeFromSuperlayer ? The code listed here has the same behavior for all variations of the included comments being uncommented and not uncommented, Transaction or no transaction. What am I missing?
- (void)animationDidStop:(CAAnimation *)anim finished:(BOOL)flag
{
//[self setHidden: YES];
//[CATransaction flush];
[CATransaction begin];
[CATransaction setValue:(id)kCFBooleanTrue
forKey:kCATransactionDisableActions];
//[CATransaction setDisableActions: YES];
//[CATransaction setAnimationDuration: 0];
[self removeFromSuperlayer];
[CATransaction commit];
}
I have been searching around, and this code is not any different from what I have found.