Reputation: 1442
In my code I have:
-(BOOL)textFieldShouldReturn:(UITextField*)theTextField{
if (theTextField == ITload)
{
[ITload resignFirstResponder];
return YES;
}
if (theTextField == FacilitiesLoad) {
[FacilitiesLoad resignFirstResponder];
return YES;
}
return NO;
}
ITload and FacilitiesLoad are both my text fields. I'm using Numerical with punctuation keyboard and no done key appears. I have a return key which doesnt close the keyboard down.
Any ideas on how to display a done key and to get textFieldShouldReturn working please?
Upvotes: 0
Views: 564
Reputation:
It seems that you haven't set the delegate of your text fields to your receiver.
ITLoad.delegate = self;
FacilitiesLoad.delegate = self;
EDIT: you're getting warnings because your view controller doesn't (formally) comforms to the UITextFieldDelegate protocol. Declare it like this:
@interface MyViewController: UIViewController <UITextFieldDelegate> {
}
etc.
Upvotes: 3