问题
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];
回答1:
You should use the resignFirstResponder method of UIResponder
, which UITextField inherits from:
[tempTextField resignFirstResponder];
来源:https://stackoverflow.com/questions/1107610/keyboard-doesnt-disappear