我检查了一些其他帖子,发现一些 UIAnimation 过渡提供了执行 Flip+Scale 过渡的解决方案,就像 iPad 上的 iTunes 应用程序一样。但是,我没有得到完全相同的结果。我试过循环 UIView 动画但不起作用。
有人可以对此有所了解吗?
所以我一直在努力,我终于找到了解决方案:)
[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 是翻转+缩放过渡结束后显示的视图。希望能帮助任何希望实现这一点的人:)