Show uiview on top of everything (even the keyboard)

In my application, I sometimes show a message to the user, and I want it to be on top of everything (even the keyboard), as UIAlertView did.

I searched for it and found a solution that:

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

It works. However, this is not documented, so I think Apple will not accept it, right?

What do you think about it? Do you know the Apple-inherited way to do this?

thanks

Vincent

+4
source share
3 answers

UIWindow is just a subclass of UIView. Therefore, the addSubView function is documented, which should make it acceptable :)

+3
source

addSubView: documented and should not be a problem. However, you must ensure that you are not violating one of the gazillion offers included in the Human Interface Guide.

+1
source

Add your view directly to keyWindow.

0
source

Source: https://habr.com/ru/post/1369620/


All Articles