对于UIPopoverController中的某些模式,UIDatePicker无法正确呈现 [英] UIDatePicker not rendering properly for certain modes in UIPopoverController
问题描述
我有一个 UIDatePicker
使用我在iPhone应用程序中模拟使用的 UIDatePickerModeTime
,工作正常:
I have a UIDatePicker
using UIDatePickerModeTime
that I use in an iPhone app modally, works fine:
为iPad使用相同的基本代码,但将视图放在 UIPopoverController
中会产生一些非常不一致的结果。我想要的模式( UIDatePickerModeTime
)加上其他三种模式如下所示。请注意其中2个根本没有呈现,而是没有内容
Using this same basic code for iPad, but putting the view in a UIPopoverController
gives some pretty inconsistent results. My desired mode (UIDatePickerModeTime
) plus the other three modes are shown below. Notice how 2 of them are not rendering at all, but instead have no content
UIDatePickerModeTime
UIDatePickerModeCountDownTimer
UIDatePickerModeDateAndTime
UIDatePickerModeDate
可能导致 UIDatePickerModeTime
和 UIDatePickerModeDateAndTime $ c的原因$ c>模式去干扰?
What could be causing the UIDatePickerModeTime
and UIDatePickerModeDateAndTime
modes to go haywire?
推荐答案
实例化 UIDatePicker
CGRectZero
是罪魁祸首。即使代码在iPhone上工作,我也明确地调用 sizeToFit
来设置大小,将 CGRectZero
更改为 CGRectMake(0,0,320,160)
是显示它的原因。去图。
Instantiating the UIDatePicker
with CGRectZero
was the culprit. Even though the code worked on iPhone, and I call sizeToFit
explicitly on it to set the size, changing the CGRectZero
to CGRectMake(0,0,320,160)
was what got it to display. Go figure.
这篇关于对于UIPopoverController中的某些模式,UIDatePicker无法正确呈现的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!