Background during modal view horizontal flip transition

喜夏-厌秋 提交于 2020-01-14 19:18:26

问题


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?

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).

Any help would be greatly appreciated.


回答1:


Go to your AppDelegate and to

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

do this:

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

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



来源:https://stackoverflow.com/questions/10360308/background-during-modal-view-horizontal-flip-transition

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!