Skip to content

Commit

Permalink
fix childViewControllerForStatusBarStyle and `preferredStatusBarSty…
Browse files Browse the repository at this point in the history
…le` don't work. CocoaDebug#25
  • Loading branch information
MQZHot committed Jul 21, 2018
1 parent a12151d commit ab2df0d
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
5 changes: 5 additions & 0 deletions Sources/Window/CocoaDebugTabBarController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,16 @@ class CocoaDebugTabBarController: UITabBarController {
override func viewWillAppear(_ animated: Bool) {
super.viewWillAppear(animated)
CocoaDebugSettings.shared.visible = true
let y = UIApplication.shared.statusBarFrame.size.height
let w = UIScreen.main.bounds.size.width
let h = UIScreen.main.bounds.size.height-UIApplication.shared.statusBarFrame.size.height
WindowHelper.shared.window?.frame = CGRect(x: 0, y: y, width: w, height: h)
}

override func viewWillDisappear(_ animated: Bool) {
super.viewWillDisappear(animated)
CocoaDebugSettings.shared.visible = false
WindowHelper.shared.window?.frame = UIScreen.main.bounds
}

//MARK: - private
Expand Down
5 changes: 4 additions & 1 deletion Sources/Window/WindowHelper.swift
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,10 @@ public class WindowHelper: NSObject {
var displayedList = false

private override init() {
self.window = CocoaDebugWindow(frame: UIScreen.main.bounds)
let y = UIApplication.shared.statusBarFrame.size.height
let w = UIScreen.main.bounds.size.width
let h = UIScreen.main.bounds.size.height-UIApplication.shared.statusBarFrame.size.height
self.window = CocoaDebugWindow(frame: CGRect(x: 0, y: y, width: w, height: h))
super.init()
}

Expand Down

0 comments on commit ab2df0d

Please sign in to comment.