CATransition在背景中出现白色闪光? [英] CATransition white flash in background?

查看:257
本文介绍了CATransition在背景中出现白色闪光?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正尝试从左侧而不是右侧制作pushViewController幻灯片,如下所示:

I'm trying to make a pushViewController slide in from the left, not the right, as follows:

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

执行此操作时,当前的控制器会褪色为白色,看起来很糟糕。为什么会这样?我尝试将当前视图Alpha的背景设置为0。

When I do this, the current controller fades to white, which looks terrible. Why does this happen? I've tried setting the background of the current view's alpha to 0.

推荐答案

我弄清楚了是什么导致了白色闪烁:这是主窗口的背景。将此设置为alpha = 0有助于增强白色效果。它似乎kCATransitionPush实际上使被推离屏幕的视图褪色 ,并且很明显,如果下面的内容是绿色的,那么它将褪色为绿色。如果它也不会消失,那就太好了,但这是一个不同的问题。

I figured out what was apparently causing the white flash: it was the background of the main window. Setting this to alpha=0 helps the white effect. It appears that kCATransitionPush actually fades the view being pushed off screen, and obviously if what is under that is green, then it'll fade to green. It'd be nice if it didn't also fade, but that's a different question.

这篇关于CATransition在背景中出现白色闪光?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆