我已经在我的应用程序中添加UIPickerView
了。它在 iPhone 上完美运行,但是当我在 iPad 上运行相同的代码时,我的 pickerView 不会在单击按钮时隐藏。
一些代码:inputView
UITextField
done
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;
我必须更改(添加?)什么才能使选择器消失?
编辑:inputAccessoryViewDidFinish
是我的方法,它只是调用
[self.someInput resignFirstResponder]