“UIPickerView奇怪的显示行为”

huangapple go评论68阅读模式
英文:

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").

“UIPickerView奇怪的显示行为”

So I select "18 11 01" but it shows "... 11 ..." (but now you can see "17 10 ..." above it).

“UIPickerView奇怪的显示行为”

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!

huangapple
  • 本文由 发表于 2023年5月11日 13:46:54
  • 转载请务必保留本文链接:https://go.coder-hub.com/76224468.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定