gpt4 book ai didi

iphone - 背景中有 CATransition 白色闪光?

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

我正在尝试使 pushViewController 从左侧而不是右侧滑入,如下所示:

Page14Controller * controller = [[Page14Controller alloc] initWithNibName:@"Page14Controller" bundle:nil];

CATransition* transition = [CATransition animation];
transition.duration = 0.3;
transition.type = kCATransitionPush;
// transition.type = kCATransitionMoveIn;
transition.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut];
//kCATransitionMoveIn; //, kCATransitionPush, kCATransitionReveal, kCATransitionFade
transition.subtype = kCATransitionFromLeft;
//kCATransitionFromLeft, kCATransitionFromRight, kCATransitionFromTop, kCATransitionFromBottom
[self.navigationController.view.layer addAnimation:transition forKey:nil];

[self.navigationController pushViewController:controller animated:NO];

当我执行此操作时,当前 Controller 逐渐变为白色,这看起来很糟糕。为什么会这样?我试过将当前 View 的 alpha 背景设置为 0。

最佳答案

我弄清楚了导致白色闪光的明显原因:它是主窗口的背景。将其设置为 alpha=0 有助于白色效果。它appears that kCATransitionPush actually fades the view being pushed off screen ,很明显,如果它下面是绿色的,那么它就会褪色为绿色。如果它不褪色就好了,但这是另一个问题。

关于iphone - 背景中有 CATransition 白色闪光?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6433385/

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