- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
在我的应用程序中有一些要求,我需要为一些额外的功能添加新窗口,我能够成功地做到这一点。启动应用程序后,我根据要求添加和关闭窗口。但我想知道如何让当前窗口始终位于其他窗口之上以避免冲突?在 iOS 中有什么方法可以让呈现窗口始终位于其他窗口之上?
最佳答案
看看makeKeyAndVisible
API
func makeKeyAndVisible()
Shows the window and makes it the key window.
This is a convenience method to show the current window and position it in front of all other windows at the same level or lower. If you only want to show the window, change its isHidden property to false.
另外,UIApplication
有 .windows
property , 这是可见窗口和隐藏窗口的数组
var windows: [UIWindow]
你可以迭代这个数组并找到一个你要设置为关键窗口的窗口。
最后看看 .windowLevel
UIWindow
property , 它管理窗口在 z 轴上的位置。
var windowLevel: UIWindow.Level { get set }
Window levels provide a relative grouping of windows along the z-axis. All windows assigned to the same window level appear in front of (or behind) all windows assigned to a different window level. The ordering of windows within a given window level is not guaranteed.
The default value of this property is normal. For a list of other possible window levels, see UIWindow.Level.
关于ios - 如何将新添加的 UIWindow 保持在顶部,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50967280/
我是一名优秀的程序员,十分优秀!