UITextField backgroundColor set in Interface Builder is nil at runtime in iOS 14

大城市里の小女人 提交于 2020-12-30 06:12:34

问题


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.

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.

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

nameTextField.backgroundColor = .white

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?


回答1:


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



来源:https://stackoverflow.com/questions/62878121/uitextfield-backgroundcolor-set-in-interface-builder-is-nil-at-runtime-in-ios-14

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!