Hi Everyone:
I have a very simple class (shown below), however every time I run it, it returns:
Terminating app due to uncaught exception 'NSUnknownKeyException', reason: '[ setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key field1.'
I am drawing this nib file to the screen in the following way:
UIViewController *backViewController = [[UIViewController alloc] initWithNibName:@"myViewBack" bundle:[NSBundle mainBundle]];
UIView *backView = backViewController.view;
[self addSubview:backView];
The following is my code for the class that is set to File's Owner:
.h
#import <Foundation/Foundation.h>
@interface myViewBack : NSObject {
IBOutlet UITextField *field1;
IBOutlet UITextField *field2;
IBOutlet UIView *view;
}
@property (nonatomic, retain) IBOutlet UITextField *field1;
@property (nonatomic, retain) IBOutlet UITextField *field2;
@end
.m
#import "myViewBack"
@implementation myViewBack
@synthesize field1;
@synthesize field2;
- (BOOL)textFieldShouldReturn:(UITextField *)textField
{
[textField resignFirstResponder];
return YES;
}
@end