自定义推送和弹出动画 iOS 7 和 8
Posted
技术标签:
【中文标题】自定义推送和弹出动画 iOS 7 和 8【英文标题】:Custom Push and pop Animation iOS 7 and 8 【发布时间】:2014-09-20 13:14:16 【问题描述】:我正在使用此代码进行自定义模型转换 -
推送
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];
流行音乐
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 是 self.navigationController.view
我怎样才能改变它来制作 - 放大和缩小动画。有什么建议么。
【问题讨论】:
【参考方案1】:您可以使用此代码:
放大动画:
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
可以是 UIView
、UIImageView
、UIButton
或任何其他组件。
【讨论】:
以上是关于自定义推送和弹出动画 iOS 7 和 8的主要内容,如果未能解决你的问题,请参考以下文章
链 UIViewControllers 推送和弹出动画与 UINavigationController 关闭/呈现模式视图?