I have a small view and a big one, and want to flip animate between them, as a selection toggle (on a different button). I am using the UIView transition block method, a开发者_JAVA技巧nd the flip is actually happening correctly.
However, during the transition, the larger view is cropped and cut down to the exact same size as the smaller one. On complete it again goes back to full size, but with a jerk. So while victory is so close, I've been playing with different permutations and combinations for the past 5 hours with no luck in smooth transition.
Is it really not possible to transition flip between 2 views of different sizes? Someone please help!
My one line transition is below. ivCategory
is the small view, with CGSize = (40.0f,48.0f)
. ivAvatar is the large view, with CGSize = (124.0f,318.0f)
. Both are UIImageView
views. Both already exist, added as subviews in the same parent view.
[UIView transitionFromView:self.ivCategory
toView:self.ivAvatar
duration:1
options:UIViewAnimationOptionTransitionFlipFromRight|UIViewAnimationOptionShowHideTransitionViews
completion:^(BOOL finished){}];
Put the smaller view into a container view that's the same size as the larger view. The switch the larger view and the container view with your flip animation. You might be able to set opaque to NO and install a clear background color on the container view to get it to not show up at all. You'd have to test that on the lowest-end device you plan to support, though, since animating non-opaque views with transparency can be slow. (We're only supporting the 3Gs and above.)
精彩评论