View controller without a 'nib / xib'

Started by
1 comment, last by DividedByZero 11 years, 8 months ago
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;
}[/source]

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. :)
Advertisement
Really? No-one played with iOS development?
Fixed it. Thanks for the help :)

This topic is closed to new replies.

Advertisement