gpt4 book ai didi

ios - iOS 8 上弹出窗口中的 UIDatePicker 问题

转载 作者:技术小花猫 更新时间:2023-10-29 10:59:25 24 4
gpt4 key购买 nike

是否还有其他人在 iOS 8 的弹出窗口中遇到 UIDatePickers 问题?突然间我们的日期选择器没有正确显示(见截图)。选择器的一部分似乎没有显示(不过,您仍然可以与缺失的部分交互以更改时间)。

我做了一些测试,日期选择器在其他 View 中显示完美,所以它与弹出窗口或在非全屏 View 中显示选择器有关。

有没有人找到解决这些问题的方法或解决方法?

UIDatePicker issues in popovers on iOS 8

最佳答案

我在 Apple 开发者论坛(Stack Overflow 失败时我的备用知识库)中找到了解决方案。

用户 Natsu 有以下解决方案:

I have the same problem in my project. And it causes only on iPad devices (iPhone has no problem with same code). As my understanding, UIDatePicker contains UITableView and UITableViewCell for displaying picker contents and its background color is set white as default. This is the reason of this issue. iOS 7 has UITableViewCell with white background in UIDatePicker iOS 8 has UITableView with white background in UIDatePicker So my solution is that I set these background color to nil by using UIAppearance like this:

[[UITableView appearanceWhenContainedIn:[UIDatePicker class], nil] setBackgroundColor:nil]; // for iOS 8
[[UITableViewCell appearanceWhenContainedIn:[UIDatePicker class], [UITableView class], nil] setBackgroundColor:[UIColor colorWithWhite:0.0 alpha:0.0]]; // for iOS 7

The values I set are the color used on iPhone. I'm not sure that it's a correct way to fix the issue. But at least in my environment it works well. I don't know if the problem of UIPickerView causes by same reason. But checking view hierarchy may help you.

因为它使用了 UIAppearance,所以你几乎可以把它放在任何地方。我把它放在我的表格单元格类中的 awakeFromNib 中,它就像一个魅力。谢谢纳兹!

关于ios - iOS 8 上弹出窗口中的 UIDatePicker 问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25916124/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com