title: UINavigationController pushing entire UIView to top left
body: <p>I am working through 100 Days of Swift <em>without</em> the use of Storyboards and am running into some issues with the UI View almost fully being pushed under the UINavigationController. When removing the UINavigationController everything works as expected. I've attempted to add a new view, set <code>edgesForExtendedLayout =[]</code>, and adjusting the <code>y</code> of my CGRect to no avail. I am almost certain I am doing something quite goofy, but cannot for the life of me figure out what.</p>
  <p><strong>Screenshot of what the view looks like:</strong>
  <a href="https://i.stack.imgur.com/rQIAJ.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/rQIAJ.png" alt="enter image description here" /></a></p>
  <p>Expected is for the 3 buttons to be displayed starting under the navView.</p>
  <p><strong>SceneDelegate.swift:</strong></p>
  <pre><code>func scene(_ scene: UIScene, willConnectTo session: UISceneSession, options connectionOptions: UIScene.ConnectionOptions) {
        guard let windowScene = (scene as? UIWindowScene) else { return }
        window = UIWindow(frame: windowScene.coordinateSpace.bounds)
        let viewController = ViewController()
        window?.rootViewController = UINavigationController(rootViewController: viewController)
        window?.makeKeyAndVisible()
        window?.windowScene = windowScene
      }
  </code></pre>
  <p><strong>ViewController.swift:</strong></p>
  <pre><code>class ViewController: UIViewController {
  
      var button1: UIButton!
      var button2: UIButton!
      var button3: UIButton!
          
      var countries = [String]()
      var score = 0
      var correctAnswer = 0
              
      override func viewDidLoad() {
          super.viewDidLoad()
          view.backgroundColor = .white
  
          button1 = UIButton(type: .custom)
          button1.setImage(UIImage(named: &quot;us&quot;), for: .normal)
          button1.translatesAutoresizingMaskIntoConstraints = false
          button1.frame = CGRect(x: 100, y: 100, width: 200, height: 100)
          button1.layer.borderWidth = 1
          button1.layer.borderColor = UIColor.lightGray.cgColor
          view.addSubview(button1)
          
          button2 = UIButton(type: .custom)
          button2.setImage(UIImage(named: &quot;us&quot;), for: .normal)
          button2.translatesAutoresizingMaskIntoConstraints = false
          button2.frame = CGRect(x: 100, y: 230, width: 200, height: 100)
          button2.layer.borderWidth = 1
          button2.layer.borderColor = UIColor.lightGray.cgColor
          view.addSubview(button2)
          
          button3 = UIButton(type: .custom)
          button3.setImage(UIImage(named: &quot;us&quot;), for: .normal)
          button3.translatesAutoresizingMaskIntoConstraints = false
          button3.frame = CGRect(x: 100, y: 360, width: 200, height: 100)
          button3.layer.borderWidth = 1
          button3.layer.borderColor = UIColor.lightGray.cgColor
          view.addSubview(button3)
          
          countries += [&quot;estonia&quot;, &quot;france&quot;, &quot;germany&quot;, &quot;ireland&quot;, &quot;italy&quot;, &quot;monaco&quot;, &quot;nigeria&quot;, &quot;poland&quot;, &quot;russia&quot;, &quot;spain&quot;, &quot;uk&quot;, &quot;us&quot;]
          
          
          askQuestion()
      }
      
      func askQuestion() {
          countries.shuffle()
          correctAnswer = Int.random(in: 0...2)
          
          button1.setImage(UIImage(named: countries[0]), for: .normal)
          button2.setImage(UIImage(named: countries[1]), for: .normal)
          button3.setImage(UIImage(named: countries[2]), for: .normal)
          
          title = countries[correctAnswer].uppercased()
      }
  }
  </code></pre>