在模态视图水平翻转过渡期间的背景 [英] Background during modal view horizontal flip transition

查看:89
本文介绍了在模态视图水平翻转过渡期间的背景的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用基于iOS 5故事板的项目。在呈现模态视图控制器时,我选择使用水平翻转过渡。在过渡期间,背景是黑色的,考虑到我的应用程序的设计,这不是特别美观。如何在转换期间更改背景颜色?

I am using an iOS 5 storyboard-based project. When presenting a modal view controller I have selected to use the horizontal flip transition. During the transition the background is black, which is not particularly aesthetic given the design of my app. How can I change the background colour during the transition?

在非故事板项目中,我能够更改MainWindow.xib的背景颜色,但由于此文件是不再出现在故事​​板项目中,这是无法做到的。另外,由于故事板的入口点是UINavigationController,似乎没有任何背景颜色的属性(我怀疑无论如何都会产生影响,因为我需要更改的背景颜色与窗口相关联而不是主视图控制器,因为该视图控制器基本上被翻转以显示模态视图控制器。)

On non-storyboard projects I was able to change the background colour of the MainWindow.xib, but since this file is no longer present in storyboard projects this cannot be done. Additionally, as the entry point of the storyboard is a UINavigationController there doesn't seem to be any property for a background colour (I doubt that would make a difference anyway, since the background colour I need to change is associated with the window and not the main view controller, since that view controller is essentially being flipped to display the modal view controller).

任何帮助将不胜感激。

推荐答案

转到您的AppDelegate并

Go to your AppDelegate and to

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions

执行此操作:

window.layer.contents = (id)[UIImage imageNamed:@"IMAGE_NAME.png"].CGImage;

或者如果你只是想改变颜色,那么改变图层的backgroundColor属性..希望这有助于

or if you just want to change the color, then change the backgroundColor property of the layer.. Hope this helps

这篇关于在模态视图水平翻转过渡期间的背景的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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