UIDatePicker无法正确显示 [英] UIDatePicker not displaying correctly

查看:161
本文介绍了UIDatePicker无法正确显示的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

基本上,当我更新我的应用程序以使用iOS 9运行时,此问题开始。在代码中现在没有任何更改,白色方块出现在选择器视图上,但它正常工作。





请注意,用户可以隐藏和显示选择器视图及其所在的单元格

更新:以下是表格视图的完整截图:





UPDATE 2 :当我预览(按下bar空格按钮)变量调试器中的 _pickerView 属性时,显示如下。这使我认为奇怪视图是在UIDatePickerView内,这是一个错误。





更新3:广泛研究



所以我最终使用视图检查器和调试器做了更多的研究,到一些结论,虽然我还是不知道如何解决它。
使用视图层次调试器我发现了白色奇怪视图它是 UIPickerTableView UIDatePicker




这里我们可以看到主题选择为蓝色,并且其名称位于屏幕顶部。我还写了从选择器视图到主题的整个层次结构,以便您可以看到它。



下一步是检查我的 datePicker var与调试器,看看是否可以得到 UIPickerTableView 导致问题。在其中,我可以找到 3个视图,每个视图对应于每个组件(日,月,年)。让我们快速浏览下列各项:



点击图片放大





在第一个和第三个(日和年),我们可以看到看起来像一些错位的观点旁边的实际标签与数字。这些属性,如你在屏幕截图中可以看到, UIPickerColumnViews 。我没有进一步,但你可以想象如果我们检查该属性,我们会发现主题作为 UIPickerTableView



毕竟,我得到的结论是,这些意见的错位是什么可能导致的问题。



最后更新



因此,在提交错误报告后的几天苹果回答并标记它作为重复。所以我想我们只需要等他们修复它。您可以在 rdar:// 22566989 查看雷达

解决方案

Apple开发人员关系将我的错误报告标记为重复,因此我想这是一个SDK错误,他们必须解决。



解决方法



viewDidLoad()方法更改日期选择器的属性,例如模式。你不必离开它改变,你可以设置它的任何东西,然后改回你实际想要的。


Basically this issue started when I updated my app to run with iOS 9. Without making any change in the code now a white square appears over the picker view, but it works normally.

Note that the user can hide and show the picker views and the cells they're in. If you need more info leave a comment.

UPDATE: Here is the full screenshot of the Table View:

UPDATE 2: The following shows when I preview (press bar space button) the _pickerView property in the variables debugger. This makes me think the strange view is inside the UIDatePickerView and that it's a bug.

UPDATE 3: Extensive Research

So I finally did more research using the view inspector and the debugger and I got to some conclusion, although I still don't know how to solve it. Using the view hierarchy debugger I found out the the white strange view it's a UIPickerTableView inside the UIDatePicker.

Here we can see the subject selected in blue and it's name at the top of the screen. I also wrote the whole hierarchy from the picker view to the subject so you can see it.

Next step was inspecting my datePicker var with the debugger to see if I could get to that UIPickerTableView causing problems. Inside it I could find 3 views, each one corresponding to each component (day, month, year). Let me show you the quick look of each one of these:

Click the pics to enlarge

In the first and the third one (day and year) we can see what look like some misplaced views next to the actual labels with the numbers. These properties, as you can see in the screenshot, are UIPickerColumnViews. I didn't go any further but you can imagine that if we inspect that property we would find the subject as a UIPickerTableView.

After all that I got to the conclusion that the misplacement of those views is what might be causing the issue. And that's all for today.

FINAL UPDATE

So some days after filing the bug report Apple answered and marked it as a duplicate. So I guess we just have to wait they fix it. You can check the radar at rdar://22566989

解决方案

Apple Developer Relations marked my bug report as a duplicate, so I guess it is an SDK bug that they'll have to solve. It is still open by the time of this post (12 Oct).

Workaround

In the viewDidLoad() method change a property of the date picker, for example the mode. You don't have to leave it changed, you can set it to anything and then change it back to what you actually want.

这篇关于UIDatePicker无法正确显示的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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