I have added a UIViewController to my project and it works fine, except when I add the buttons. I am getting an error: * Terminating app due to uncaught exception 'NSUnknownKeyException', reason: '[ setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key cancel.'
Here is the code for the header and implementation files. All of this code is auto-generated when I use the Assistant Editor and CTRL drag from each control to the header file.
SignUpViewController.h:
#import <UIKit/UIKit.h>
@interface SignUpViewController : UIViewController {
IBOutlet UITextField *leader;
IBOutlet UITextField *emailAddress;
IBOutlet UITextField *firstName;
IBOutlet UIScrollView *scrollView;
IBOutlet UITextField *lastName;
}
- (IBAction)cancel:(id)sender;
- (IBAction)signUp:(id)sender;
@end
SignUpViewController.m
#import "SignUpViewController.h"
@interface SignUpViewController ()
@end
@implementation SignUpViewController
- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
if (self) {
}
return self;
}
- (void)viewDidLoad
{
[super viewDidLoad];
[scrollView setScrollEnabled:YES];
[scrollView setContentSize:CGSizeMake(320, 1000)];
}
- (void)viewDidUnload
{
firstName = nil;
lastName = nil;
emailAddress = nil;
leader = nil;
[super viewDidUnload];
}
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
return (interfaceOrientation == UIInterfaceOrientationPortrait);
}
- (IBAction)cancel:(id)sender {
}
- (IBAction)signUp:(id)sender {
}
@end
I am not sure why the error is occuring. Any ideas?