问题
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