【发布时间】:2013-01-12 19:33:56
【问题描述】:
我的问题是:What is the best way to implement "Hiding Keyboard while PickerView (which is inside the PopOver) is Visible"?
我想要什么:
我有一个视图,其中包含 15 TextFields。在 15 个中,比如说 7 个使用 UIPickerView(位于 UIPopOverController 中)来实现 DropDown Functionality。我的问题是当键盘可见并且我用UIPickerView 单击UITextField 时,键盘没有隐藏。实现这一点的最佳方法是什么?
我尝试了什么:
我尝试实现inputView,但它仅用于UIPickerView,而我在UIPopOverController 中有UIPickerView。我认为这就是我无法使用 inputView 属性的原因。根据这个Question,是苹果的Bug。
更新:
看,我知道使用 textField Delegates ,我们可以实现这一点。但是我找到了UITextField 的inputView 属性,我发现它很有趣,因为您只需将其分配为:
textField.inputView = pickerView;
但我在PopOver 中有UIPickerView。那么如何使用UITextField中的inputView property呢?
还有更好的主意吗?...
【问题讨论】:
-
只有两种方法可以做到这一点 resignFirstResponder 或成为FirstResponder 由其他控件。你还有什么办法??
标签: iphone keyboard uitextfield uipickerview uipopovercontroller