Friday, April 20, 2012

Smoothly rotate and change size of UIView with shadow

I have a UIView with a shadow, and subview of the view is a UIImageView.

I want to resize the view when the iPad is rotated, and I'm trying to do this in willRotateToInterfaceOrientation.

If I set the shadow on the UIView in the basic way, the rotation is very choppy, so I'd like to use the suggestion by some people to set the shadow setting layer.shadowPath.

I have tried animating the frame size change using [UIView animateWithDuration:animations], and setting the new shadowPath in the same block, but the shadow path snaps to the new size.

And if I don't change the shadowPath in the animations block, it doesn't change.

From a few searches I've done, animating changes to layer stuff needs to be done with a CABasicAnimation.

So I think the question is, how do I animate a frame size and layer change simultaneously?

No comments:

Post a Comment