UItableViewCell with UIDatePicker : month column gets covered

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-01 11:33:13

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:

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!