UIAlertView 上方的 UIView [英] UIView above UIAlertView
本文介绍了UIAlertView 上方的 UIView的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
在我的应用中,使用了锁屏.有时会显示 UIAlertView
,现在当用户将应用程序发送到后台并再次将其带到前面时,UIAlertView
会显示在锁定屏幕上方.是否有可能在所有内容之上添加 UIViewController
的视图,即在 UIAlertView
之上?
In my app, a lock screen is used. Sometimes a UIAlertView
is shown, now when the user sends the app to the background and brings it in front again, the UIAlertview
is shown above the lock screen. Is there a possibility to add a UIViewController
's view above everything, i.e. above the UIAlertView
?
推荐答案
你应该有这样的
UIWindow *mySpecialWindowForLockScreen = [[UIWindow alloc]initWithFrame:[[UIScreen mainScreen] bounds]];
//"Hey iOS Please put this window above all alert view"
mySpecialWindowForLockScreen.windowLevel = UIWindowLevelAlert+100;
UIViewController *lockScreenViewController = [[UIViewController alloc]init];//Lock Screen
lockScreenViewController.view.frame = mySpecialWindowForLockScreen.bounds;
mySpecialWindowForLockScreen.rootViewController = lockScreenViewController;
// In lockScreenViewController view you can add lock screen images and other UI stuff
mySpecialWindowForLockScreen.rootViewController.view.backgroundColor = [UIColor greenColor];
[mySpecialWindowForLockScreen makeKeyAndVisible];
每当您想隐藏 LockScreen 窗口时,只需通过 setHidden:YES 将其隐藏.
Whenever you want to hide the LockScreen window then simply hide it by setHidden:YES.
这篇关于UIAlertView 上方的 UIView的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文