iOS获取最上层Window

let windows = Array(UIApplication.shared.windows.reversed())
        for window in windows {
            let windowOnMainScreen = window.screen == UIScreen.main
            let isWindowVisible = !window.isHidden && window.alpha > 0
            let windowLevelSupport = window.windowLevel == UIWindowLevelNormal
            let isKeyWindow = window.isKeyWindow
            if windowOnMainScreen && isWindowVisible && windowLevelSupport && isKeyWindow {
                return window
            }
        }
        return UIApplication.shared.keyWindow
0 0 投票数
文章评分
订阅评论
提醒
guest
0 评论
内联反馈
查看所有评论
京ICP备17066706号-1
0
希望看到您的想法,请发表评论。x
()
x