2014-09-20 54 views
3

我使用自定義模式轉型這個代碼 -定製push和pop動畫的iOS 7和8

推送

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]; 

對於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]; 

的觀點是自我。 navigationController.view

我該如何改變這一點 - 放大和縮小動畫。有什麼建議麼。

回答

0

您可以使用此代碼:

放大動畫:

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 

縮小動畫:

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可以是UIViewUIImageViewUIButton或任何其他組件。