在iOS 14中运行时在Interface Builder中设置的UITextField backgroundColor为零 [英] UITextField backgroundColor set in Interface Builder is nil at runtime in iOS 14

查看:89
本文介绍了在iOS 14中运行时在Interface Builder中设置的UITextField backgroundColor为零的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个可以在iOS 11-13上正常运行的应用程序,但是当我在iOS 14中运行该应用程序时,即使其中的几个文本字段都呈现为零且透明的背景色,即使在界面生成器中将背景颜色显式设置为白色.

I have an app that works properly on iOS 11-13, but when I run it in iOS 14 several text fields within it are rendered with a nil, and so transparent, background color even though the background color is set to White explicitly in the Interface Builder.

在代码中我看不到任何使用那些可能会弄乱背景颜色的文本字段的情况,并且在相同情况下运行的这些相同的UITextField在iOS 13及更低版本上显示为白色背景.

I can't see anywhere in the code that uses those text fields that might mess up the background color, and these same UITextFields running under the same scenarios appear with White background on iOS 13 and below.

如果我在代码中明确设置颜色,则在iOS 14中一切正常.

If I set the color explicitly in code everything works fine in iOS 14

nameTextField.backgroundColor = .white

我不想添加多余的代码只是为了重置背景色.关于iOS 14中新的UITextField行为,我可能会缺少任何东西吗?

I don't want to add redundant code just to reset the background color. Is there anything I might be missing about new UITextField behaviour in iOS 14?

推荐答案

在Xcode 12 GM中,遍历情节提要和重置文本字段的背景色对我来说是成功的秘诀.

Going through the storyboards and resetting the background color of the text fields did the trick for me in Xcode 12 GM.

这篇关于在iOS 14中运行时在Interface Builder中设置的UITextField backgroundColor为零的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆