I have a UIView with several custom-drawed sublayers (a few CAGradientLayers with CAShapeLayer masks, etc.). I'm using the UIView animation method to animate it's bounds (increasing both its width and height).
[UIView animateWithDuration:2 delay:0 options:UIViewAnimationOptionCurveEaseOut|UIViewAnimationOptionAutoreverse|UIViewAnimationOptionRepeat animations:^{
CGRect bounds = myView.bounds;
bounds.size.width += 20;
bounds.size.height += 20;
myView.bounds = bounds;
} completion:nil];
This works fine, except for the fact that the sublayers don't get redrawn as its animating. What the best way to do this? Do I need to setup some key-value observing detect bounds change and call setNeedsDisplay on all the sublayers?