使用带有rootViewController的第二个UIWindow时,黑屏的界面旋转 [英] Blacked-out interface rotation when using second UIWindow with rootViewController
问题描述
(iOS 7.0.3,Xcode 5.0.1)
(iOS 7.0.3, Xcode 5.0.1)
我的应用中有第二个UIWindow,用于在状态栏上方显示自定义放大镜。但是,一旦我设置了这个窗口的rootViewController(用于界面旋转和其他一些东西),主窗口在界面旋转动画期间变黑。
I have a second UIWindow in my app used to display a custom magnifier above the status bar. However, once I set the rootViewController of this window (for interface rotation & some other stuff), the main window goes black during the interface rotation animation.
重现:创建单视图iOS应用程序并将以下内容添加到主UIViewController。
To reproduce: create single view iOS application and add the following to the main UIViewController.
// To @interface:
@property (nonatomic, strong) UIWindow *secondWindow;
// In viewDidLoad:
self.secondWindow = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds];
self.secondWindow.rootViewController = [[UIViewController alloc] initWithNibName:nil bundle:nil];
self.secondWindow.hidden = NO;
感谢任何帮助。
推荐答案
我将添加另一个答案,因为我找到了一个实际可行的解决方法。将窗口的背景颜色以及视图控制器视图的背景颜色设置为alpha为0的颜色。不要使用 clearColor
,而是使用类似<$ c的颜色$ c> greenColor] colorWithAlphaComponent:0.0]; 它有效。
I will add another answer, because I have found a workaround that actually works. Set the window's background color, as well as the view controller's view's background color to a color with an alpha of 0. Do not use clearColor
, but rather use something like greenColor] colorWithAlphaComponent:0.0];
It works.
这篇关于使用带有rootViewController的第二个UIWindow时,黑屏的界面旋转的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!