简体   繁体   English

具有警报级别的UIWindow在状态栏级别的顶部

[英]UIWindow with Alert level is on top of Status Bar level

I have an app that presents modally View Controllers, I have a standard ViewController and an UIAlertController in different UIWindows, the main with normal UIWindowLevel priority and the Alert window with Alert UIWindowLevel priority, because I want to always have the alert on top of whatever ViewController I present modally on the main UIWindow (AppDelegates reference). 我有一个可以模态显示View Controller的应用程序,我在不同的UIWindows中有一个标准的ViewController和一个UIAlertController,主要具有正常的UIWindowLevel优先级,而Alert窗口则具有Alert UIWindowLevel优先级,因为我想始终将警报放在任何ViewController之上我以模态形式显示在主UIWindow(AppDelegates参考)上。 I also have another UIWindow with Status Bar priority, for moments when I want for sure to have a different ViewController on top of everything. 我还拥有另一个具有状态栏优先级的UIWindow,用于确保确定所有内容之上都具有其他ViewController的时刻。 So when I present the UIWindow with a Alert UIWIndowLevel priority and after I present a different window with Status Bar UIWIndowLevel the alert in the Alert Window is displaying on top of the Status Bar window. 因此,当我向UIWindow提供优先级为Alert UIWIndowLevel的UIWindow并在为状态窗口UIWIndowLevel提供不同的窗口之后,Alert窗口中的警报将显示在Status Bar窗口的顶部。 Is there a reason for that? 有什么理由吗?

An example app screenshot I built to test in 我构建用于测试的示例应用屏幕截图

So, I was looking at some of the many SOs opened and saw this answer: https://stackoverflow.com/a/24262942/6784707 因此,我正在查看许多开放的SO中的一些,并看到了以下答案: https : //stackoverflow.com/a/24262942/6784707

I printed the values of (UIWindowLevelNormal, UIWindowLevelAlert, UIWindowLevelStatusBar) are (0.0, 2000.0, 1000.0). 我打印了(UIWindowLevelNormal,UIWindowLevelAlert,UIWindowLevelStatusBar)的值是(0.0、2000.0、1000.0)。 But Apple's documentations states that: 但是Apple的文档指出:

let UIWindowLevelNormal : UIWindowLevel UIWindowLevelNormal :UIWindowLevel

The default level. 默认级别。 Use this level for the majority of your content, including for your app's main window. 此级别适用于大部分内容,包括应用程序的主窗口。

let UIWindowLevelAlert : UIWindowLevel UIWindowLevelAlert :UIWindowLevel

The level for an alert view. 警报视图的级别。 Windows at this level appear on top of windows at the UIWindowLevelNormal level. 此级别的Windows出现在UIWindowLevelNormal级别的窗口顶部。

let UIWindowLevelStatusBar : UIWindowLevel UIWindowLevelStatusBar :UIWindowLevel

The level for a status window. 状态窗口的级别。 Windows at this level appear on top of windows at the UIWindowLevelAlert level . 此级别的 Windows 出现在UIWindowLevelAlert级别的窗口顶部

I filled a bug in Apple's Bug Reporter. 我在Apple的Bug Reporter中填写了一个错误。

My solution was to create a CGFloat with value over 2000 and add it to windowLevel. 我的解决方案是创建一个值超过2000的CGFloat,并将其添加到windowLevel。

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

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