iphone-"Use of Undeclared Identifier 'textFieldShouldReturn' Objective C
I've hit an "Use of Undeclared Identifier" Error. Seems there could be a
lot of reasons for this, and I couldn't see what the problem was with
mine. First, here's the code:
#import "CMViewController.h"
#import "CMAEncode.h"
@interface CMViewController ()
@property (weak, nonatomic) IBOutlet UITextView *toCode;
@property (weak, nonatomic) IBOutlet UITextView *Coded;
@property (weak, nonatomic) IBOutlet UISwitch *onOrOff;
- (IBAction)StartEncodeDecode:(id)sender;
@end
@implementation CMViewController
- (void)viewDidLoad
{
[super viewDidLoad];
// Do any additional setup after loading the view, typically from a nib.
}
- (void)didReceiveMemoryWarning
{
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}
- (IBAction)StartEncodeDecode:(id)sender {
NSString *finishedText;
NSString *toCode = self.toCode.text;
if (self.onOrOff.on == TRUE) {
finishedText = [CMAEncode encodeText:toCode];
self.Coded.text = finishedText;
} else {
}
-(BOOL)textFieldShouldReturn:(UITextField *)textField // Undeclared
Identifier here.
{
[textField resignFirstResponder];
return YES;
}
}
@end
I'm trying to make a textfield resign first responder so the keyboard will
return. But I really just want to know why this error is occurring, it
might help people out with future instances of this error.
No comments:
Post a Comment