2

I am creating an application on IPad. I use a text field with default return key to write message.After writing a message I press return key..Then the keyboard dissappeared, but the method - (BOOL)textFieldShouldReturn:(UITextField *)textField {} does NOT get called. I have some code within the textFieldShouldReturn function...

- (BOOL)textFieldShouldReturn:(UITextField *)textField {

[textField resignFirstResponder];
[UIView beginAnimations:nil context:NULL];
[UIView setAnimationDuration:0.3];  
if(cPageNavType == CUTSOM_NAV_BAR){
    mToolbar.frame = CGRectMake(0, 438, 320, 44);
    mTableView.frame = CGRectMake(0, 40, 340, 400); 
}else {
    mTableView.frame = CGRectMake(0, 0, 340, 480-44-18-28);
    mToolbar.frame = CGRectMake(0, 480-44-18-28, 320, 44);
}
[UIView commitAnimations];

//[self postMessage:nil];
return YES;
}

so what can I do? Thanks in advance

2
  • Did you set the delegate properly?
    – Manlio
    Jul 28, 2011 at 14:57
  • Are you sure method doesn't get called? Did you try a breakpoint or a NSLog at the beginning of the method?
    – Manlio
    Jul 29, 2011 at 9:22

1 Answer 1

0

Things to check

  1. Add <UITextFieldDelegate> ,make your class receiver of delegate
  2. OfCourse add delegate method(put break points)
  3. Connect the textfield outlets (delegates and referencing outlets if any)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.