swift
extension UIWindow
{
fileprivate class func window() -> UIWindow{
// let window = UIApplication.shared.windows.last! 这是原来的代码
let window = UIApplication.shared.keyWindow! //这是修改后的代码(亲测有效,可以正常显示)
if(!window.isHidden){
return window;
}
return (UIApplication.shared.delegate?.window!)!;
}
}