xcode - iOS9:UIDatePicker 和 UIDatePickerModeTime 的 datePickerMode 只显示小时,没有分钟

标签 xcode uidatepicker xcode7 ios9 uidatepickermodetime

我在 iOS9 模拟器上使用 Xcode beta 7。
使用带有 UIDatePickerModeTime 的 datePickerMode 的 UIDatePicker 只显示小时,而不是分钟。

看截图:

enter image description here

在 iOS 7 和 8 上,显然它按预期工作,并显示小时和分钟。截屏:

enter image description here

我真的不想重新发明轮子并滚动我自己的时间选择器。关于为什么会发生这种情况以及如何解决的任何想法?我在谷歌上找不到任何东西。

谢谢,
亚历克斯

最佳答案

在 iOS 9 发行说明中找到了有关此问题的有用描述 - 似乎我应该更仔细地阅读这些内容。

UIPickerView and UIDatePicker are now resizable and adaptive—previously, these views would enforce a default size even if you attempted to resize them. These views also now default to a width of 320 points on all devices, instead of to the device width on iPhone. Interfaces that rely on the old enforcement of the default size will likely look wrong when compiled for iOS 9. Any problems encountered can be resolved by fully constraining or sizing picker views to the desired size instead of relying on implicit behavior.



iOS 9 Release Notes

就我而言,我所要做的就是删除 UIDatePicker 上的所有约束,然后“重置为建议的约束”。重建,现在一切都很好。

关于xcode - iOS9:UIDatePicker 和 UIDatePickerModeTime 的 datePickerMode 只显示小时,没有分钟,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31709525/

相关文章:

iphone - 使用 tableview 作为 uitextview

ios - UIDatePicker 返回所有日期中实例化的 dateTime 秒数..?

ios - iPad 中 PopoverView 中的 UIDatePicker

swift - 如何使用 UIDatePicker 输入管理带有两个 UITextField 的 firstResponder

ios - Xcode 7 管理器加载永远 - 如何修复?

ios - 我可以在不下载的情况下将 iOS 模拟器从旧版 Xcode 6.4 添加到新版 Xcode 7 吗?

ios - 在 Xcode 中设置自定义类适用于 iOS 9.1 模拟器,但不适用于 iOS 8.4

ios - 无法将 Player 类型的值分配给 SKSpriteNode 类型

ios - 如何在 Xcode 4.2 中针对 RestKit 框架进行构建?

ios - 我应该使用 segue 在注册屏幕和我的应用程序的其余部分之间移动吗