Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

kingthong

macrumors member
Original poster
Sep 20, 2010
62
0
Somewhere but not here.
First off, nice April Fool's prank!

Second, this is a simple question but when i chose New Project -> View Based Application there is a viewController already created for me.

Now in my AppDelegate i have the following code by default:

Code:
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {    
    
    // Override point for customization after application launch.

    // Add the view controller's view to the window and display.
    [self.window addSubview:viewController.view];
    [self.window makeKeyAndVisible];

    return YES;
}

My question is where is the viewController being alloc and init'ed?
(Purely for knowledge purposes)
 
I'm pretty sure it's deserialized from the main nib which is declared in the Info.plist file. But I am at work on a PC so can't check right now.
 
Why don't you add this method to your view controller set a breakpoint in it and then tell us the answer?

Code:
-(id)initWithCoder:(NSCoder *)aDecoder
{
	if ((self = [super initWithCoder:aDecoder]))
	{
	}

	return self;  // set a breakpoint on this line
}
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.