title: How to overlay a view on the status bar in ios13
body: <pre class="lang-swift prettyprint-override"><code>fileprivate lazy var netTipWindow:UIWindow = {
          let window = UIWindow(frame: CGRect(x: 0, y: topMargins, width: UIScreenW, height: realheight))
          window.backgroundColor = .clear
          window.windowLevel = .alert
          window.isHidden = false
          window.rootViewController = UIViewController()
          window.rootViewController?.view.addSubview(self)
          frame = CGRect(x: 0, y: -(topMargins + realheight), width: UIScreenW, height: realheight)
          return window
      }()
  
  </code></pre>
  
  <p>My Code works well in ios 12, but it works like the picture.</p>
  
  <p>Also, I tried this code, it makes no difference</p>
  
  <pre class="lang-swift prettyprint-override"><code>    fileprivate lazy var netTipWindow:UIWindow = {
          let window = UIWindow(frame: CGRect(x: 0, y: topMargins, width: UIScreenW, height: realheight))
          window.backgroundColor = .clear
          window.windowLevel = .alert
          window.isHidden = false
          if #available(iOS 13, *) {
              window.addSubview(self)
          } else {
              window.rootViewController = UIViewController()
              window.rootViewController?.view.addSubview(self)
          }
          frame = CGRect(x: 0, y: -(topMargins + realheight), width: UIScreenW, height: realheight)
          return window
      }()
  </code></pre>
  
  <p><a href="https://i.stack.imgur.com/AQJ6Z.jpg" rel="noreferrer">iOS 13 status bar</a></p>