A frame is a derived property of various other properties, such as position, borders, anchorPoint, and any transformation that it applies to it. It is not recommended to animate this property directly, especially when working with lower-level CoreAnimation levels.
In this case, I assume that you want to animate the borders. You can use the UIView animation method above, but when working with CALayers directly, I prefer to use the CoreAnimation animation methods.
CGRect oldBounds = mask.bounds; CGRect newBounds = self.content.bounds; CABasicAnimation* revealAnimation = [CABasicAnimation animationWithKeyPath:@"bounds"]; revealAnimation.fromValue = [NSValue valueWithCGRect:oldBounds]; revealAnimation.toValue = [NSValue valueWithCGRect:newBounds]; revealAnimation.duration = 3.0;
source share