英文:
UIPIckerview strange display behaviour
问题
I have an app written a few years ago using UIPickerView and had been working until now.
它是几年前编写的应用程序,使用UIPickerView编写,一直在工作,直到现在。
It doesn't display properly for iOS 16. So I thought I'd use Xcode to submit another build with the latest libraries etc but it still doesn't work!
它在iOS 16上无法正确显示。因此,我想使用Xcode提交另一个版本,使用最新的库等,但仍然无法正常工作!
I've attached the screenshots, you can see from the first one it should be "17 10 00" but it's showing "... ... ..."
我已经附上了截图,您可以从第一张图片中看到应该是 "17 10 00",但它显示为 "…… …… ……"。
So I select "18 11 01" but it shows "... 11 ..."
所以我选择 "18 11 01",但它显示为 "…… 11 ……"。
There's no fixed pattern as to which numbers are displayed. All seem random.
没有固定的模式来显示数字。似乎都是随机的。
I've made the picker quite big (like in this case) and it still doesn't display properly, so it's not a matter of the font size being too big for the display field.
我已经将选择器调整得很大(就像在这种情况下),但它仍然无法正确显示,因此不是字体大小对显示字段过大的问题。
Has anyone seen this or know how to fix it?
有人见过这个问题或知道如何修复吗?
英文:
I have an app written a few years ago using UIPickerView and had been working until now.
It doesn't display properly for iOS 16. So I thought I'd use Xcode to submit another build with the latest libraries etc but it still doesn't work!
I've attached the screenshots, you can see from the first one it should be "17 10 00" but it's showing "... ... ..." (but you can see "18 11 01").
So I select "18 11 01" but it shows "... 11 ..." (but now you can see "17 10 ..." above it).
There's no fixed pattern as to which numbers are displayed. All seem random.
I've made the picker quite big (like in this case) and it still doesn't display properly, so it's not a matter of the font size being too big for the display field.
Has anyone seen this or know how to fix it?
The numbers are selected correctly and displays correctly in a text label.
答案1
得分: 1
我找到了设置列宽的代码,而且不出所料,一旦我更改了宽度的值,数字就再次正确显示了!然后,我添加了一个 "pickerView(_ pickerView: UIPickerView, viewForRow row: Int" 来将字体大小设置为固定值,而不是使用默认值,问题就解决了!
英文:
I found the code where the column width was set and lo and behold, once I changed the value of the width the numbers appear correctly again! And then I put in a "pickerView(_ pickerView: UIPickerView, viewForRow row: Int" to set the font size to a fixed value rather than leaving it to default, and the problem is solved!
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论