【发布时间】:2012-07-02 06:16:12
【问题描述】:
我查看了其他几篇文章,发现一些 UIAnimation 过渡提供了执行 Flip+Scale 过渡的解决方案,就像 iPad 上的 iTunes 应用程序一样。但是,我没有得到完全相同的结果。我试过循环 UIView 动画,但不起作用。
有人能解释一下吗?
【问题讨论】:
我查看了其他几篇文章,发现一些 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 是翻转+缩放过渡结束后显示的视图。希望对希望实现此功能的人有所帮助:)
【讨论】: