Jump to content
  • Advertisement
Sign in to follow this  
DarkRonin

View controller without a 'nib / xib'

This topic is 2221 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;
}[/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. :)

Share this post


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

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!