Rad'Val
Rad'Val

Reputation: 9231

Adding a custom view controller to a storyboard

I'm trying to add a custom root view controller (let's call it MyViewController) to my storyboard but every time I do so, I get a black screen, no warning, no error, no nothing, just a back screen. The strange thing is, if I log self.window.rootViewController the object is of MyViewController type. Also, if I use a standard UIViewController instead of MyViewController everything's fine. Did anybody encountered this strange issue before?

Upvotes: 2

Views: 1895

Answers (1)

Janardan Yri
Janardan Yri

Reputation: 751

The stock UIViewController subclass that Xcode provides you has loadView overridden. If you're using it with a storyboard, remove the overridden loadView implementation.

I keep getting exactly this same issue and every time it takes me a few seconds of confusion before I remember what's going on...!

Upvotes: 3

Related Questions