UIDateTimePicker dropped on contentView of UITableViewCell in InterfaceBuilder Xcode 6.1 gets covered by white tiles. How to prevent it?
问题:
回答1:
Update: This issue is resolved as of iOS9 beta 5. (2015.08.24)
There seems to be a bug in UIDatePicker on iOS8. We just noticed this in Portrait mode on an iPad:
@BS4248 - Is this similar to what you're seeing? For us, the Hour column is missing instead of the Month column. It doesn't happen on any device running iOS7 and it doesn't happen on iPhones.
I was curious what was happening here so I set the background color of the datepicker to red in the debugger console:
expr [cell.datePicker setBackgroundColor:[UIColor redColor]]
It seems that something is covering or breaking the Hour column in the datepicker, but after a couple hours trying to pick apart the picker I stumbled across something that fixes it for us. We had trailing and leading constraints set to stretch the UIDatepicker to the full width of the screen. When I deleted those it rendered correctly again:
And now when I set the background to red you can see it's much narrower: