Wie kann ich eine UIView gleichzeitig mit dem iOS 7 iPad App Store drehen und vergrößern?
Der iPad iOS 7 App Store bietet eine ziemlich coole Animation, wenn Sie auf ein App-Symbol klicken (aus der Liste der empfohlenen Symbole, wenn das Symbol kleiner ist, kein Suchergebnis). Hier ist ein Bild davon in Aktion:
Grundsätzlich wird das Symbol umgedreht und gleichzeitig vergrößert.
Dahinter befindet sich ein Farbverlauf und die Inhaltsansicht ist kleiner.
Bisher habe ich ein benutzerdefiniertes VC-Übergangs-Setup und ich habe den Vergrößerungsteil in Ordnung, aber ich kann den Flip nicht zum Jiven bringen. Wie kann ich die App Store-Animation nachahmen?
Hier ist der Code, den ich bisher habe:
- (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];
}
}];
}