UIDatePicker切断文本而不显示天数

时间:2021-05-31 22:21:38

My app is suddenly unable to correctly display UIDatePickers. I'm using storyboards. The Datepickers are set to just display the date. They are cutting off the month, and also not even showing the days. There's a big space in the middle. I have tried cleaning the project, resetting the simulator, checking localization settings, and checking to see if dynamic type size was set. I'm using Xcode 5.1.1 but the same thing happens in the beta of Xcode 6. Any suggestions would be appreciated.

我的应用程序突然无法正确显示UIDatePickers。我正在使用故事板。 Datepickers设置为仅显示日期。他们正在切断月份,甚至还没有显示日子。中间有一个很大的空间。我已经尝试清理项目,重置模拟器,检查本地化设置,并检查是否设置了动态类型大小。我正在使用Xcode 5.1.1,但同样的事情发生在Xcode 6的测试版中。任何建议都将受到赞赏。

UIDatePicker切断文本而不显示天数

2 个解决方案

#1


2  

Ok, I figured it out. This happened as a result of trying to use UIAppearance on a tableView background color. This has nothing to do with tableViews on the face of it, but Apple must be using a tableView privately for the PickerViews. So, my attempt to set a UIAppearance via a category on a tableView background color seems to be doing something unexpected. Lesson learned. Don't try to use UIAppearance where they are not officially supported.

好的,我明白了。这是因为尝试在tableView背景颜色上使用UIAppearance。这与表面上的tableViews无关,但Apple必须私下使用tableView作为PickerViews。因此,我尝试通过tableView背景颜色上的类别设置UIAppearance似乎做了一些意想不到的事情。学过的知识。不要在没有官方支持的情况下尝试使用UIAppearance。

#2


0  

I had this exact same issue, and it was related to duplicate constraints in my storyboard. I'd been implementing iPhone 6 widths and inadvertently ended up with both width = 320 and width >= 320. Removing that width = 320 fixed it instantly.

我有这个完全相同的问题,它与我的故事板中的重复约束有关。我一直在实现iPhone 6宽度,无意中最终得到宽度= 320和宽度> = 320.删除宽度= 320立即修复它。

#1


2  

Ok, I figured it out. This happened as a result of trying to use UIAppearance on a tableView background color. This has nothing to do with tableViews on the face of it, but Apple must be using a tableView privately for the PickerViews. So, my attempt to set a UIAppearance via a category on a tableView background color seems to be doing something unexpected. Lesson learned. Don't try to use UIAppearance where they are not officially supported.

好的,我明白了。这是因为尝试在tableView背景颜色上使用UIAppearance。这与表面上的tableViews无关,但Apple必须私下使用tableView作为PickerViews。因此,我尝试通过tableView背景颜色上的类别设置UIAppearance似乎做了一些意想不到的事情。学过的知识。不要在没有官方支持的情况下尝试使用UIAppearance。

#2


0  

I had this exact same issue, and it was related to duplicate constraints in my storyboard. I'd been implementing iPhone 6 widths and inadvertently ended up with both width = 320 and width >= 320. Removing that width = 320 fixed it instantly.

我有这个完全相同的问题,它与我的故事板中的重复约束有关。我一直在实现iPhone 6宽度,无意中最终得到宽度= 320和宽度> = 320.删除宽度= 320立即修复它。