Keyboard doesn't disappear

纵饮孤独 提交于 2020-01-16 06:28:24

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!