I have a subclassed UIView that is comprised of several layers (mostly CAShapeLayers with a few CATextLayers). The problem I have is that if I animate resizing the UIView using an animation block (beginAnimations, commitAnimations) and relayout the sublayers in the overridden layoutSubviews, then the layers are not animated with the UIView.
Below is my code to animate the frame of the UIView:
miniView.backgroundColor = [UIColor orangeColor];
[UIView beginAnimations:nil context:nil];
[UIView setAnimationDuration:1.0f];
[UIView setAnimationCurve:UIViewAnimationCurveEaseInOut];
[UIView setAnimationRepeatCount:MAXFLOAT];
[UIView setAnimationRepeatAutoreverses:YES];
miniView.frame = newFrame;
[UIView commitAnimations];
So the problem is that the view is properly animated but the sublayers are not. I can see the view growing and shrinking but the sublayers grow immediately and then stay the new larger size. What is the best way to resize the sublayers of a view when the view is resized? And how do I make those animate in the same way with the parent view?