[英]UIPickerView as inputView not hiding on iPad
I have added UIPickerView
as inputView
to UITextField
in my app. 我在我的应用程序
inputView
UIPickerView
作为inputView
添加到UITextField
。 It works perfectly on iPhone, but when I run the same code on iPad, my pickerView does not hide on clicking done
button. 它在iPhone上完美运行,但是当我在iPad上运行相同的代码时,我的pickerView在点击
done
按钮时不会隐藏。
Some code: 一些代码:
picker = [[UIPickerView alloc] initWithFrame:CGRectZero];
picker.delegate = self;
picker.dataSource = self;
[picker setShowsSelectionIndicator:YES];
self.someInput.inputView = provincePicker;
UIToolbar *pickerToolbar = [[UIToolbar alloc] initWithFrame:CGRectMake(0, 0, 320, 44)];
UIBarButtonItem *doneButton = [[UIBarButtonItem alloc]
initWithBarButtonSystemItem:UIBarButtonSystemItemDone
target:self action:@selector(inputAccessoryViewDidFinish)];
[pickerToolbar setItems:[NSArray arrayWithObject:doneButton] animated:NO];
self.someInput.inputAccessoryView = pickerToolbar;
What do I have to change (add?) to make picker disappear? 我需要更改(添加?)才能使选择器消失?
edit: inputAccessoryViewDidFinish
is my method, it just calls 编辑:
inputAccessoryViewDidFinish
是我的方法,它只是调用
[self.someInput resignFirstResponder]
-(void)inputAccessoryViewDidFinish
{
[self.someInput resignFirstResponder];
}
EDIT: Implement -disablesAutomaticKeyboardDismissal and return NO. 编辑:实现-disablesAutomaticKeyboardDismissal并返回NO。 That should alllow the keyboard to dismiss.
这应该是键盘解雇。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.