【发布时间】:2012-10-23 11:54:43
【问题描述】:
我必须用两个UIWindow 创建应用程序(请不要问为什么)。首先UIWindow 的rootViewController 支持所有方向。第二个 - 只有纵向和倒置。所以应用程序委托代码如下所示:
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
// part one
self.windowOne = [[[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]] autorelease];
self.windowOne.rootViewController = [[ViewControllerOne alloc] init]; // supports all orientations
self.windowOne.rootViewController.view = [[[UIImageView alloc] initWithImage:[UIImage imageNamed:@"image1.png"]] autorelease];
[self.windowOne makeKeyAndVisible];
//~part one
// part two
self.windowTwo = [[[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]] autorelease];
self.windowTwo.rootViewController = [[ViewControllerTwo alloc] init]; // supports only portrait and upside down
self.windowTwo.rootViewController.view = [[[UIImageView alloc] initWithImage:[UIImage imageNamed:@"image2.png"]] autorelease];
[self.windowTwo makeKeyAndVisible];
//~part two
return YES;
}
如果两个部分中只有一个处于活动状态(第二个被评论)- 一切正常。但是如果 windowOne 在 windowTwo 之前已经成为 key 并且可见,windowTwo 会在 ViewControllerTwo 允许的情况下旋转,但状态栏的行为非常奇怪:它像 windowOne 一样旋转是 key 并且可见。
是否有任何选项可以让状态栏像ViewControllerTwo 所说的那样旋转?
【问题讨论】:
标签: objective-c ios uiviewcontroller uiwindow