【发布时间】:2013-11-15 07:15:54
【问题描述】:
在我的应用程序中,我想在主 UIWindow 上创建一个新的UIWindow,我写了如下内容,但它不起作用。
首先,我创建了一个UIWindow 作为主窗口,然后将其设为关键且可见,然后创建一个新的UIWindow 叠加层,但没有任何反应。
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
self.window.backgroundColor = [UIColor redColor];
ViewController *vc = [[ViewController alloc]initWithNibName:@"ViewController" bundle:nil];
self.window.rootViewController = vc;
[self.window makeKeyAndVisible];
UIWindow *window1 = [[UIWindow alloc] initWithFrame:CGRectMake(0, 0, 320, 320)];
window1.backgroundColor = [UIColor redColor];
window1.windowLevel = UIWindowLevelAlert;
[window1 makeKeyAndVisible];
return YES;
}
【问题讨论】:
-
为什么它对我有用,我的 Xcode 是 V5.0
-
我在 xCode 4.6 和 5 中尝试过,它可以工作。
-
和你的模拟器版本?