带有UIDatePicker的UItableViewCell:月份列被覆盖 [英] UItableViewCell with UIDatePicker : month column gets covered

查看:72
本文介绍了带有UIDatePicker的UItableViewCell:月份列被覆盖的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在InterfaceBuilder Xcode 6.1中UITableViewCell的contentView上放置的UIDateTimePicker被白色图块覆盖.如何预防呢?

UIDateTimePicker dropped on contentView of UITableViewCell in InterfaceBuilder Xcode 6.1 gets covered by white tiles. How to prevent it?

推荐答案

更新:此问题已从iOS9 beta 5开始解决.(2015.08.24)

iOS8的UIDatePicker中似乎有一个错误.我们刚刚在iPad上的人像"模式下注意到了这一点:

There seems to be a bug in UIDatePicker on iOS8. We just noticed this in Portrait mode on an iPad:

@ BS4248-这与您所看到的相似吗?对于我们来说,缺少小时"列而不是月份"列.在运行iOS7的任何设备上都不会发生这种情况,在iPhone上也不会发生这种情况.

@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.

我很好奇这里发生了什么,所以我在调试器控制台中将datepicker的背景色设置为红色:

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]]

似乎日期选择器中的小时"列覆盖或破坏了某些内容,但是几个小时后,我试图将选择器拆开,但我偶然发现了一些可以解决该问题的东西.我们设置了尾随和前导约束,以将UIDatepicker拉伸到屏幕的整个宽度.当我删除它们时,它再次正确呈现:

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:

这篇关于带有UIDatePicker的UItableViewCell:月份列被覆盖的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆