ios 13 获取keyWindow
2019-10-15 本文已影响0人
ClementGu
swift 写法 如下
if let window = UIApplication.shared.windows.first(where: { (wd) -> Bool in
if wd.isKeyWindow
{
return true
}
else
{
return false
}
}){
self.frame = UIScreen.main.bounds
window.addSubview(self)
}