mySpecialWindowForLockScreen

mySpecialWindowForLockScreen

在我的应用程序中,使用了锁定屏幕。有时会显示 UIAlertView,现在当用户将应用程序发送到后台并再次将其置于前面时,UIAlertview 会显示在锁定屏幕上方。是否有可能在所有内容之上添加 UIViewController 的 View ,即在 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 将其隐藏即可。

关于ios - UIAlertView 上方的 UIView,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/24262649/

10-12 04:22