像iPad上的iTunes一样翻转和缩放过渡 [英] Flip+Scale Transition like iTunes on iPad
问题描述
我检查了其他几篇文章,发现一些UIAnimation过渡,就像iPad上的iTunes应用程序一样,为执行Flip + Scale过渡提供了解决方案.但是,我没有得到完全相同的结果.我已经尝试过循环播放UIView动画,但是不起作用.
I have checked few other posts and found some UIAnimation transitions that kind-of give the solution to do the Flip+Scale transition just like the iTunes app on iPad. However, i do not get exactly the same results. I have tried looping UIView animations but does not work.
有人可以阐明这一点吗?
Can someone shed some light on this?
推荐答案
所以我一直在努力,终于找到了解决方案:)
So i have been working on this and i finally found a solution :)
[UIView animateWithDuration:0.4 delay:0 options:UIViewAnimationOptionBeginFromCurrentState animations:
^{
rect = placeHolderView.frame;
rect.origin.x += 100;
rect.origin.y += 70;
[UIView beginAnimations:nil context:NULL];
[UIView setAnimationDuration:0.5];
placeHolderView.frame = rect;
[UIView setAnimationTransition:UIViewAnimationTransitionFlipFromRight forView:placeHolderView cache:YES];
[UIView setAnimationDuration:0.5];
CGAffineTransform transform = CGAffineTransformMakeScale(3.0, 3.0);
placeHolderView.transform = transform;
[UIView commitAnimations];
self.view.layer.cornerRadius = 5.0f;
self.view.clipsToBounds = YES;
} completion:^(BOOL finished) {
[UIView setAnimationBeginsFromCurrentState:YES];
[UIView transitionWithView:placeHolderView duration:0.8 options:UIViewAnimationOptionTransitionFlipFromRight|UIViewAnimationOptionBeginFromCurrentState animations:
^{
CGAffineTransform transform = CGAffineTransformMakeScale(10.0, 10.0);
placeHolderView.transform = transform;
[UIView beginAnimations:nil context:NULL];
[UIView setAnimationTransition:UIViewAnimationTransitionFlipFromRight forView:self.purchaseItemView cache:YES];
[placeHolderView setAlpha:0.0];
[self.myMainView setAlpha:1.0];
[UIView setAnimationDuration:0.8];
[UIView commitAnimations];
} completion:nil];
}
];
placeholderView是将从16x6小型图像缩放的视图.当myMainView是翻转+缩放过渡结束后显示的视图时.希望对希望实现此目标的任何人有所帮助:)
The placeholderView is the view that will be scaled from a small 16x6 image. While myMainView is the view shown after the flip+scale transition is over. Hope that helps anyone looking to implement this :)
这篇关于像iPad上的iTunes一样翻转和缩放过渡的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!