简体   繁体   English

在所有内容(甚至键盘)上显示uiview

[英]show uiview on top of everything (even keyboard)

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. 在我的应用程序中,我有时会向用户显示一条消息,我希望它能在所有内容(甚至是键盘)之上,就像UIAlertView可以做的那样。

I googled it and found the solution which is: 我用Google搜索并找到了解决方案:

    [[[[UIApplication sharedApplication] delegate] window] addSubview:myViewOnTop];

This works. 这有效。 However this is not documented, so I guess Apple won't accept it, right ? 然而,这没有记录,所以我猜Apple不会接受它,对吧?

What do you think about it ? 你怎么看待这件事 ? Do you know an Apple legacy way to do it ? 你知道Apple的传统方式吗?

Thanks 谢谢

Vincent 文森特

UIWindow is just a subclass of UIView. UIWindow只是UIView的子类。 Therefore the addSubView function is documented which should make it acceptable :) 因此,记录了addSubView函数,它应该可以接受:)

addSubView: is documented and should not be a problem. addSubView:已记录,不应该是一个问题。 However, you should ensure that you do not violate one of the gazillion clauses included in the Human Interface Guidelines. 但是,您应确保不违反人机界面指南中包含的众多条款之一。

将您的视图直接添加到keyWindow。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM