开发者

UIDatePicker not rendering properly for certain modes in UIPopoverController

开发者 https://www.devze.com 2023-01-21 20:58 出处:网络
I have a UIDatePicker using UIDatePickerModeTime that I use in an iPhone app modally, works fine: Using this same basic code for iPad, but putting the view in a UIPopoverController gives some prett

I have a UIDatePicker using UIDatePickerModeTime that I use in an iPhone app modally, works fine:

UIDatePicker not rendering properly for certain modes in UIPopoverController

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 re开发者_如何学Cndering at all, but instead have no content

UIDatePickerModeTime

UIDatePicker not rendering properly for certain modes in UIPopoverController

UIDatePickerModeCountDownTimer

UIDatePicker not rendering properly for certain modes in UIPopoverController

UIDatePickerModeDateAndTime

UIDatePicker not rendering properly for certain modes in UIPopoverController

UIDatePickerModeDate

UIDatePicker not rendering properly for certain modes in UIPopoverController

What could be causing the UIDatePickerModeTime and UIDatePickerModeDateAndTime modes to go haywire?


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消