Skip to content

Commit c3cb150

Browse files
committed
Fixed an infinite recursion prefersStatusBarHidden()
1 parent 7cbe8f3 commit c3cb150

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

KRProgressHUD/Classes/KRProgressHUDViewController.swift

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,18 @@
88
import UIKit
99

1010
class KRProgressHUDViewController: UIViewController {
11+
var statusBarHidden = false
12+
1113
override func viewDidLoad() {
1214
super.viewDidLoad()
1315
view.backgroundColor = UIColor(white: 0, alpha: 0.4)
1416
}
1517

1618
override func prefersStatusBarHidden() -> Bool {
17-
guard let vc = UIApplication.topViewController() else { return false }
18-
return vc.prefersStatusBarHidden()
19+
guard let vc = UIApplication.topViewController() else { return statusBarHidden }
20+
if !vc.isKindOfClass(KRProgressHUDViewController) {
21+
statusBarHidden = vc.prefersStatusBarHidden()
22+
}
23+
return statusBarHidden
1924
}
2025
}

0 commit comments

Comments
 (0)