更改 UIViewAnimationTransition 背后的背景
当动画转换到另一个视图时,我使用以下代码:
[UIView beginAnimations:@"transition" context:nil];
[UIView setAnimationDuration:0.5];
[UIView setAnimationTransition:UIViewAnimationTransitionFlipFromLeft
forView:self.navigationController.view cache:NO];
[self.navigationController pushViewController:newView animated:NO];
[UIView commitAnimations];
这工作正常,但在翻转动画期间,动画后面有纯白色背景。我想知道是否有人知道更改动画背后背景颜色的简单方法。谢谢!
When animating a transition to another view I am using the following code:
[UIView beginAnimations:@"transition" context:nil];
[UIView setAnimationDuration:0.5];
[UIView setAnimationTransition:UIViewAnimationTransitionFlipFromLeft
forView:self.navigationController.view cache:NO];
[self.navigationController pushViewController:newView animated:NO];
[UIView commitAnimations];
This works fine but during the flip animation there is a solid white background behind the animation. I was wondering if anyone knows a simple way to change the color of this background behind the animation. Thanks!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
它应该是
UIWindow
或keyWindow.rootViewController.view
的backgroundColor
。将动画视图下方每个视图的
backgroundColor
设置为[UIColor blackColor]
应该可以解决您的问题(也不要忘记 UIWindow 的背景颜色)。It's should be the
backgroundColor
of yourUIWindow
orkeyWindow.rootViewController.view
.Set the
backgroundColor
of every view below your animated view to[UIColor blackColor]
should solve your problem (don't forget the UIWindow's backgroundColor too).我认为您在动画后面看到的纯白色背景只是下面任何视图的背景颜色。只需更改该视图的背景颜色(
view.backgroundColor = [UIColor blackColor]
或类似的颜色)就可以改变您在下面看到的内容。I think the solid white background you see behind the animation is just the background color of whatever view is underneath. Simply changing the background color of that view (
view.backgroundColor = [UIColor blackColor]
or something like that) should change what you see underneath.