• Advertisement
Sign in to follow this  

View controller without a 'nib / xib'

This topic is 2038 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi Guys,

I am trying my hand at iOS programming and am about four hours into it.

I have managed to create a basic layout using a hybrid of a 'nib' file and programmatically creating buttons, to see how it is done.

I have just started a new app where I am trying to make a basic UI without the use of a 'nib' at all.

So, far so good. But I am having troubles making the view controller for the window.

This is what I have so far

[source]- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
// Override point for customization after application launch.
self.window.backgroundColor = [UIColor whiteColor];
self.viewController = [[ViewController alloc] initWithNibName:@"ViewController" bundle:nil];
self.window.rootViewController = self.viewController;

[self.window makeKeyAndVisible];
return YES;

Although, this causes the app to crash as it is calling initWithNibName:@"ViewController" which doesn't exist.

How do I tell the viewController that I am not using a 'nib' so it will then go and call loadView?

Any help would by much appreciated. And please be gentle as I am a C++ Win32 coder, so all of this iOS stuff is new to me.

Thanks in advance. :)

Share this post

Link to post
Share on other sites
Sign in to follow this  

  • Advertisement