Custom Push and Pop Animations iOS 7 and 8
I am using this code for a custom model transition -
For Push
CATransition *transition = [CATransition animation]; transition.type = kCATransitionPush; transition.duration = 0.3; transition.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut]; transition.subtype = kCATransitionFromTop; [view.layer addAnimation:transition forKey:nil];
For Pop
CATransition *transition = [CATransition animation]; transition.type = kCATransitionPush; transition.duration = 0.3; transition.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut]; transition.subtype = kCATransitionFromBottom; [view.layer addAnimation:transition forKey:nil];
view is self.navigationController.view
how can i change this to make Zoom and Zoom animations. any suggestions.
+3
San007
source
to share
1 answer
You can use this code:
Enlarge animation:
self.yourComponent.transform = CGAffineTransformMakeScale(1, 1);
[UIView beginAnimations:@"zoomIn" context:nil];
[UIView setAnimationDuration:1.0]; // Time in seconds
self.yourComponent.transform = CGAffineTransformMakeScale(1.2, 1.2); // 20% bigger
Decrease animation:
self.yourComponent.transform = CGAffineTransformMakeScale(1.2, 1.2);
[UIView beginAnimations:@"zoomOut" context:nil];
[UIView setAnimationDuration:1.0]; // Time in seconds
self.yourComponent.transform = CGAffineTransformMakeScale(1, 1);
self.yourComponent
It can be UIView
, UIImageView
, UIButton
or any other component.
0
Haroldo gondim
source
to share