views:

382

answers:

1

While using UITextField in objective c, keyboard appears, after typing some figure I wanna move to another Textfield or button but neither the cursor removes from text field nor the key board disappears. Wat should i do?

tempTextField.borderStyle = UITextBorderStyleBezel;
tempTextField.textColor = [UIColor blackColor];
tempTextField.font = [UIFont systemFontOfSize:17.0];
tempTextField.placeholder = @"";
tempTextField.backgroundColor = [UIColor blueColor];
tempTextField.autocorrectionType = UITextAutocorrectionTypeNo; 

tempTextField.keyboardType = UIKeyboardTypeDefault; 
tempTextField.returnKeyType = UIReturnKeyDone;
tempTextField.clearButtonMode = UITextFieldViewModeNever;
tempTextField.clearButtonMode = UITextFieldViewModeNever; 
[ tempTextField setEnabled: YES ];
self.txtAirportName = tempTextField;
txtAirportName.delegate = self;
[tempTextField release];
+4  A: 
[tempTextField resignFirstResponder];
jbrennan
Classic. I think just about everyone misses this. I know I did when I first started with iPhone development.
toast
It is a little strange. *Becoming* firstResponder is automatic (well, when the user touches the textField) but when they touch outside, it doesn't resignFirstResponder. It does feel a little unintuitive, I agree.
jbrennan
That's probably why everyone gets caught by the keyboard. If both acquiring and resigning were automatic or if both were manual, I don't think it would be an issue.
toast