Possible Duplicate:
How to make return key on iphone make keyboard disappear?
I have two text fields in the page I'm working on. Only the first text field disappears after I click return, yet it doesn't work for the second text field.
Here are the methods in my .m file:
-(void) viewWillAppear:(BOOL)animated
{
[super viewWillAppear:animated];
self.cardNameTextField.delegate = self;
self.pinTextField.delegate = self;
}
-(BOOL) textFieldShouldReturn:(UITextField *)textField
{
if (_cardNameTextField !=nil)
{
[self.cardNameTextField resignFirstResponder];
}
else if (_pinTextField !=nil)
{
[self.pinTextField resignFirstResponder];
}
return YES;
}
Advice please :)