iPad iOS 7應用程序商店有一個非常酷的動畫,當你點擊一個應用程序圖標(當圖標較小而不是搜索結果時,從特色列表中)。這裏是它在行動一個圖:如何在iOS 7 iPad App Store中同時翻轉並放大UIView?
基本上,圖標翻轉並在同一時間在尺寸膨脹。
有它後面的梯度和內容視圖較小。
到目前爲止,我有一個自定義的VC轉換設置,我有放大部分工作正常,但我不能翻轉jive。我如何模仿App Store動畫?
這裏是我的代碼至今:
- (void)animateTransition:(id<UIViewControllerContextTransitioning>)transitionContext {
UIView *inView = [transitionContext containerView];
UIViewController *fromVC = [transitionContext viewControllerForKey:UITransitionContextFromViewControllerKey];
UIViewController *toVC = [transitionContext viewControllerForKey:UITransitionContextToViewControllerKey];
UIView *fromView = [fromVC view];
UIView *toView = [toVC view];
toView.frame = [transitionContext finalFrameForViewController:toVC];
// Take a snapshot of the new view being presented
UIGraphicsBeginImageContextWithOptions(toView.bounds.size, NO, 0);
CGContextRef ctx = UIGraphicsGetCurrentContext();
[fromView.layer renderInContext:ctx];
UIImage *snapshot = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
// Add the snapshot view and animate its appearance
UIImageView *intermediateView = [[UIImageView alloc] initWithImage:snapshot];
[inView addSubview:intermediateView];
[self calculateSourceRectInView:inView];
intermediateView.frame = self.sourceRect;
[UIView animateWithDuration:[self transitionDuration:transitionContext] animations:^{
intermediateView.layer.transform = CATransform3DMakeRotation(-1.0 * -M_PI_2, 0.0, 1.0, 0.0);
intermediateView.frame = toView.frame;
} completion:^(BOOL finished) {
[intermediateView removeFromSuperview];
if ([transitionContext transitionWasCancelled]) {
[transitionContext completeTransition:NO];
} else {
[inView addSubview:toView];
[fromView removeFromSuperview];
[transitionContext completeTransition:YES];
// Now this is a pushed view, we allow interactive
// transitioning back to the parent view.
self.interactiveTransition = [EBInteractiveZoomTransition new];
[self.interactiveTransition wireToViewController:toVC];
}
}];
}