0

My all previous projects works fine with this simulator but now whenever i'm creating new ViewController in previous projects or in new project, then ViewController looks black except Nav Bar. I don't know what's the problem even i reset my simulator but nothing solve my problem,

i think this problem seem to be so complicated.

import UIKit

class ViewController: UINavigationController {

override func viewDidLoad() {
    super.viewDidLoad()

    // Do any additional setup after loading the view.
}

override func didReceiveMemoryWarning() {
    super.didReceiveMemoryWarning()
    // Dispose of any resources that can be recreated.
}



}

Currently View Controller looks here

ScreenShot attached here 1 and 2

I will be very glad if any of them help me.

Thanks

Ahtazaz
  • 903
  • 8
  • 21

2 Answers2

0

It's because you are using UINavigationController as superclass of your ViewController. You can change superclass to UIViewController and embed your ViewController in UINavigationController.

Updated code:

import UIKit

class ViewController: UIViewController {

    override func viewDidLoad() {
        super.viewDidLoad()

        // Do any additional setup after loading the view.
    }

    override func didReceiveMemoryWarning() {
        super.didReceiveMemoryWarning()
        // Dispose of any resources that can be recreated.
    }


}

Image that shows how you can embed your ViewController:

enter image description here

Ivan Smetanin
  • 1,999
  • 2
  • 21
  • 28
0

This is a UINavigationController, not a UIViewController So you need to embed UIViewController with this UINavigationController. That's why you are getting the black screen.

You need to embed UIViewController with this navigation controller.

Jogendar Choudhary
  • 3,476
  • 1
  • 12
  • 26