gpt4 book ai didi

ios - 如何将新添加的 UIWindow 保持在顶部

转载 作者:行者123 更新时间:2023-11-28 07:46:13 36 4
gpt4 key购买 nike

在我的应用程序中有一些要求,我需要为一些额外的功能添加新窗口,我能够成功地做到这一点。启动应用程序后,我根据要求添加和关闭窗口。但我想知道如何让当前窗口始终位于其他窗口之上以避免冲突?在 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/

36 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com