Adam Adamou
Adam Adamou

Reputation: 243

UIViewController come up blank with no functionality

I am having a weird problem regarding the uiviewcontroller. When the view controller is called it comes up almost blank, with only the nav bar I put through storyboard. I have a class just for this controller which specifies how it should load and what to do once it does load etc. I have assigned this class to the view controller through storyboard. I added a button so when the button is pressed the view comes up. When the view comes up there is no functionality whatsoever. I tried creating other classes and assigned it to it but still no change. My classes are set to UIViewController. The code is the basic code from when you add a class:

 #import <UIKit/UIKit.h>

@interface testViewController : UIViewController

@end

Anyone has any idea why this is happening? its been baffling me for hours.

Here is the view controller in story board

Here is how it shows up during run time

Upvotes: 0

Views: 937

Answers (1)

robinryf
robinryf

Reputation: 416

I had the same issue a while ago. After some time investigating on the Web and the templates provided by XCode I found out that if you Implement the function - (void)loadView to your ViewController the View won´t load or will just show black.

- (void)loadView
{
    // If you create your views manually, you MUST override this method and use it to create your views.
    // If you use Interface Builder to create your views, then you must NOT override this method.
}

I hope this helps.

Upvotes: 1

Related Questions