在所有内容(甚至键盘)之上显示 uiview
在我的应用程序中,我有时会向用户显示一条消息,我希望它位于所有内容(甚至键盘)之上,就像 UIAlertView 可以做的那样。
我用谷歌搜索并找到了解决方案:
[[[[UIApplication sharedApplication] delegate] window] addSubview:myViewOnTop];
这有效。然而这没有记录,所以我猜苹果不会接受它,对吗?
你对此有何看法?你知道苹果传统的做法吗?
谢谢文
森特
In my application, I sometimes show a message to the user and I want it to be on top of everything (even keyboard), like a UIAlertView could do.
I googled it and found the solution which is:
[[[[UIApplication sharedApplication] delegate] window] addSubview:myViewOnTop];
This works. However this is not documented, so I guess Apple won't accept it, right ?
What do you think about it ? Do you know an Apple legacy way to do it ?
Thanks
Vincent
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
UIWindow只是UIView的子类。因此 addSubView 函数被记录下来,这应该使它可以接受:)
UIWindow is just a subclass of UIView. Therefore the addSubView function is documented which should make it acceptable :)
addSubView:
已记录,不应该成为问题。但是,您应该确保不违反人机界面指南中包含的无数条款之一。addSubView:
is documented and should not be a problem. However, you should ensure that you do not violate one of the gazillion clauses included in the Human Interface Guidelines.将您的视图直接添加到 keyWindow 中。
Add your view directly to the keyWindow.