textFieldShouldReturn is not working in ipad
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 postMessag开发者_如何学Goe:nil];
return YES;
}
so what can I do? Thanks in advance
Things to check
- Add
<UITextFieldDelegate>
,make your class receiver of delegate - OfCourse add delegate method(put break points)
- Connect the textfield outlets (delegates and referencing outlets if any)
精彩评论