在tableView上创建多个uitextfield,其中一个textfield需要显示键盘,另一个需要弹出pickerView
现在,如果先出现pickerView然后出现键盘是正常的,但是在点击显示键盘之后,再弹出pickerView,那么键盘就回遮住pickerView,请问该如何处理?
-(void)cellSelect:(JustStringTableViewCell *)target
{
int selectRow = [[self.bookingTableView indexPathForCell:target] row] + 10000;
for (int i = 10000; i < 10000 + self.formMutArr.count; i++) {
if (i == selectRow) {
if ([target.formFieldsModel.kind isEqualToString:@"datetime"]) {
//时间日期选择
[target.rightTextField resignFirstResponder];
_pickerView = [[CustomPickerView alloc]initWithDelegete:(id)self datas:nil];
[_pickerView pickerShow];
}else if ([target.formFieldsModel.kind isEqualToString:@"date"]){
//只选择日期不选择时间
[target.rightTextField resignFirstResponder];
_pickerView = [[CustomPickerView alloc]initWithDelegete:(id)self datas:chooseArray];
[_pickerView pickerShow];
}else if ([target.formFieldsModel.kind isEqualToString:@"select"]){
//选择条目内容 valueContraint
[target.rightTextField resignFirstResponder];
_pickerView = [[CustomPickerView alloc]initWithDelegete:(id)self datas:chooseArray];
[_pickerView pickerShow];
}
}else{
UITextField *tempTextField = (UITextField *) [self viewWithTag:i];
[tempTextField resignFirstResponder];
}
}
}
When opening PickerView, execute
You try it.
Generally, the keyboard should be hidden before popping up the pickerView. This is the most normal interaction.
A more bizarre interaction is to cover the keyboard with a picker, which is generally not done by anyone. Just stick the picker on the keyboard window.
I think you should make requirements in the click response method of each textfield. For example, ab and ab do not pop up the keyboard, so you will never respond to the keyboard callout requests of these two. You only need to judge the remaining one.