【发布时间】:2017-07-13 00:00:30
【问题描述】:
主要的UIWindow 包含MainViewController,它使用lightContent 作为preferredStatusBarStyle。我创建了第二个UIWindow 实例来显示PopupViewController,它使用default 作为preferredStatusBarStyle。
当我用PopupViewController 显示第二个UIWindow 时,状态栏样式更改为default,但是当我隐藏它时,样式不会变回lightContent。
同样的问题适用于我在弹出窗口中有隐藏状态栏的 VC 的情况 - 当弹出窗口被解除时状态栏不显示。
新UIWindow创建:
// Prepare window to show dialog box in
newWindow = UIWindow(frame: UIScreen.main.bounds)
newWindow?.windowLevel = 3
// Overlay new window
newWindow?.makeKeyAndVisible()
self.mainWindow.windowLevel = 1
self.mainWindow.endEditing(true)
newWindow?.isHidden = false
// Display dialog
newWindow?.rootViewController = PopupViewController()
新的UIWindow 解雇:
UIView.animate(
withDuration: 1.0,
delay: 0,
usingSpringWithDamping: 1,
initialSpringVelocity: 0,
options: .curveEaseOut,
animations: { [weak self] in
self?.newWindow?.alpha = 0
},
completion: { [weak self] _ in
self?.newWindow?.windowLevel = 0
self?.newWindow?.rootViewController = nil
self?.newWindow?.alpha = 1
self?.mainWindow.makeKeyAndVisible()
}
)
谢谢!
编辑:弹窗随时可能出现,我不知道当时哪个VC活跃
【问题讨论】: