UIWindow 在故事板顶部不可见
我有一个 UIWindow 对象,我想将其显示在故事板顶部。我像这样制作 -
UIWindow *webWindow = [[UIWindow alloc] initWithFrame:CGRectMake(0, 20, 320,480)];
webWindow.windowLevel = UIWindowLevelAlert;
我将其设为 keyAndVisible 像这样 -
[webWindow makeKeyAndVisible];
问题是它不可见。我尝试使用 NSLog 来查看所有 Windows,它显示了类似的内容 -
Windows:(
"<UIWindow: 0x9b5cf20; frame = (0 0; 320 480); layer = <UIWindowLayer: 0x9b61400>>",
"<UIWindow: 0x9846880; frame = (0 0; 320 480); layer = <UIWindowLayer: 0x9846a60>>"
)
我在这里阅读了有关故事板如何使用窗口的内容 - http://developer.apple.com/library/ios/#documentation/UIKit/Reference/UIApplicationDelegate_Protocol/Reference/Reference.html#//apple_ref/doc/uid/TP40006786-CH3-SW30
但不清楚如何使用它在 Storyboard 顶部显示一个窗口。
I have a UIWindow object that I have want to show on top a Storyboard. That I made like this -
UIWindow *webWindow = [[UIWindow alloc] initWithFrame:CGRectMake(0, 20, 320,480)];
webWindow.windowLevel = UIWindowLevelAlert;
I am making it keyAndVisible like this -
[webWindow makeKeyAndVisible];
The problem is that it's not visible. I tried NSLog to see all the Windows and it shows something like this -
Windows:(
"<UIWindow: 0x9b5cf20; frame = (0 0; 320 480); layer = <UIWindowLayer: 0x9b61400>>",
"<UIWindow: 0x9846880; frame = (0 0; 320 480); layer = <UIWindowLayer: 0x9846a60>>"
)
I read something about how window is used by Storyboard here - http://developer.apple.com/library/ios/#documentation/UIKit/Reference/UIApplicationDelegate_Protocol/Reference/Reference.html#//apple_ref/doc/uid/TP40006786-CH3-SW30
But its not clear how to use it to show a window on top of Storyboard.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
而不是创建一个新的 UIWindow 对象并添加子视图,而是必须创建应用程序委托的对象,例如 -ExampleAppDelegate *myApp = (ExampleAppDelegate *)[UIApplication sharedApplication].delegate;并像这样添加子视图 - [myApp.window addSubview:aWebView];
Rather than making a new UIWindow object and adding a subview to had to make object of the app delegate like -ExampleAppDelegate *myApp = (ExampleAppDelegate *)[UIApplication sharedApplication].delegate; And add subView like this - [myApp.window addSubview:aWebView];