gpt4 book ai didi

ios - 让推送像现在一样生动

转载 作者:行者123 更新时间:2023-11-28 19:01:09 24 4
gpt4 key购买 nike

我正在尝试推送一个 viewController,我想更改推送的动画。原来的puch动画是从右/左翻转的,我需要从底部制作,就像present的动画一样。我尝试了以下代码,它可以工作,但是当 viewcontroller 设置动画时背景将是黑色的。我可以用它做什么?

CATransition *animation = [CATransition animation];
animation.duration = 2.0f;
animation.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut];
animation.fillMode = kCAFillModeForwards;
animation.type = kCATransitionPush;
animation.subtype = kCATransitionFromTop;
[[self.navigationController.view layer] addAnimation:animation forKey:@"animation"];
[self.navigationController pushViewController:controller animated:NO];

最佳答案

嘿,你可以使用下面的方法,同时在带有动画 NO 的导航 Controller 中推送 Controller

- (void)animateControllerFromBottomToTop
{
CATransition *animation = [CATransition animation];
[animation setDelegate:self];
[animation setType:kCATransitionPush];
[animation setSubtype:kCATransitionFromTop];
[animation setDuration:0.65f];
[animation setTimingFunction:[CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut]];
[[self.navigationController.view layer] addAnimation:animation forKey:@"AnimationFromBottomToTop"];
}

关于ios - 让推送像现在一样生动,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25521126/

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