Alright, in my rootViewController, I am able to push another viewController that I defined myself onto the screen. However, when I make any connections between that viewController and its own .h file, the program just hangs and crashes, giving me this error:
2010-06-04 15:36:13.944 pooldocfinal[11971:20b] *** Terminating app due to uncaught exception ‘NSUnknownKeyException’, reason: ‘[ setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key label1.’
That happens when i don’t connect anything besides that one UILabel. Here is the code I use to declare/push the view (named balanceViewController):
- (IBAction) pushedBalanceButton
{
balanceViewController *controller = [[balanceViewController alloc] initWithNibName:@"balanceViewController" bundle:nil];
[self.navigationController pushViewController:controller animated:YES];
[controller release];
}
And here is the .h file of the view that I am pushing, it has only one thing in it:
#import <UIKit/UIKit.h>
@interface balanceViewController : UIViewController {
IBOutlet UILabel *label1;
}
@end
And like I said, everything works unless I actually make a connection in Interface Builder between anything in balanceViewController.xib and balanceViewController.h (in this case, it is the one UILabel object).
I believe if you have an IBOutlet, you need to define getters/setters. That’s what Key Value coding compliant means. You can do this via @property statements and @synthesize statements, or manually if you so choose.
Then add
to your implementation
EDIT – PS, don’t forget to [label1 release] in your dealloc method