gpt4 book ai didi

ios - 自定义推送和弹出动画 iOS 7 和 8

转载 作者:塔克拉玛干 更新时间:2023-11-02 08:38:09 24 4
gpt4 key购买 nike

我正在使用此代码进行自定义模型转换 -

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

我怎样才能改变它来制作 - 放大和缩小动画。有什么建议么。

最佳答案

您可以使用此代码:

放大动画:

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 或任何其他组件。

关于ios - 自定义推送和弹出动画 iOS 7 和 8,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25949175/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com