     open override func viewWillDisappear(_ animated: Bool) {
         super.viewWillDisappear(animated)
 
-        statusBarHidden = false
-    }
-
-    // MARK: Status Bar
-
-    private var statusBarHidden: Bool = false {
-        didSet {
-            setNeedsStatusBarAppearanceUpdate()
-            if !statusBarHidden {
-                afterStatusBarAppearedAction?()
-            }
-        }
-    }
-
-    open override var prefersStatusBarHidden : Bool {
-        return statusBarHidden
-    }
-
-    open override var preferredStatusBarUpdateAnimation : UIStatusBarAnimation {
-        return .fade
+        view.window?.windowLevel = windowLevelBeforePreview ?? UIWindowLevelNormal
     }
 
     // MARK: Selectors

                print("Warning: currentlyDisplayedPhoto.image is nil")
            }
        }
    }

    open override func viewWillAppear(_ animated: Bool) {
        super.viewWillAppear(animated)

        DispatchQueue.main.asyncAfter(deadline: DispatchTime.now() + Double(Int64(0.15 * Double(NSEC_PER_SEC))) / Double(NSEC_PER_SEC)) { [weak self] in
            self?.statusBarHidden = true
        }
    }

    open override func viewDidAppear(_ animated: Bool) {


open class PhotosViewController: UIViewController {

    public var windowLevelInPreview: UIWindowLevel = UIWindowLevelStatusBar + 1
    private var windowLevelBeforePreview: UIWindowLevel?

    fileprivate weak var delegate: PhotosViewControllerDelegate?
    fileprivate let dataSource: PhotosViewControllerDataSource
