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

Depress

macrumors newbie
Original poster
Jun 22, 2009
4
0
Hi,

Like the title says, i want to switch from view 1 to view 2.
So i started searching and came up with this:
Code:
		ViewControllerStats *newViewController = [[ViewControllerStats alloc] initWithNibName: @"Statistics" bundle:nil];
		IceStatsAppDelegate *appDelegate = (IceStatsAppDelegate *)[[UIApplication sharedApplication] delegate];
		[self.view removeFromSuperview];
		[[appDelegate window] addSubview: [newViewController view]];

This code is located in the view controller of the first view. From this view i want to go to the second view(ViewControllerStats is its UIViewController).

When i try to debug it crashes on the point of the last code line.
The console gives me this line of code:
Code:
 Terminating app due to uncaught exception 'NSUnknownKeyException', reason: '[<ViewControllerStats 0xf4c400> setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key delegate.

Because this is a learning cycle for me i got no clue what to do next to fix this.

Greetings
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.