[英]iOS 7 : UITextField inputView issue when set to UIDatePicker
I have set UIDatePicker
as TextField
's inputView. 我已经将UIDatePicker
设置为TextField
的inputView。 When TextField
becomes firstResponder
the first time, UIDatePicker
's height is smaller than standard height as shown below : 当TextField
首次成为firstResponder
时, UIDatePicker
的高度小于标准高度,如下所示:
Then after any time TextField
becomes firstResponder
, UIDatePicker
's height is correct as shown below : 然后,在任何时候TextField
成为firstResponder
, UIDatePicker
的高度都是正确的,如下所示:
This issue is not there when I run app on iOS 6 simulator, but only there when run on iOS 7. 当我在iOS 6模拟器上运行应用程序时,不会出现此问题,而只有在iOS 7上运行时才存在。
Any idea why is this? 知道为什么吗? Can it be related to auto layout? 它可以与自动布局相关吗?
I had added UIDatePicker
in storyboard. 我已经在情节UIDatePicker
中添加了UIDatePicker
。 Now, I have solved the issue by creating UIDatePicker
through code and setting it as inputView. 现在,我通过代码创建UIDatePicker
并将其设置为inputView来解决了该问题。 I am still looking for an answer that explains the reason why it did not work with storyboard. 我仍在寻找一个答案,以解释为什么它无法与情节提要一起使用的原因。 I will change accepted answer if I get any. 如果有,我将更改接受的答案。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.