1

When I create UITextField and place it on a View, it is displayed correctly (with white color) but when I run my app in simulator UITextField changes its color from default white to view's background color. Does anyone know how to solve this problem? See screenshots below.

Preview:

enter image description here

Simulator:

enter image description here

leopoldubz
  • 39
  • 4

1 Answers1

1

Starting in Xcode 12 you will need to set the text field's background color, as it now defaults to nil (clear). So as @aheze mentioned you'll need to set it to white manually with yourTextField.backgroundColor = UIColor.white.

Related to this question UITextField backgroundColor set in Interface Builder is nil at runtime in iOS 14

Wyetro
  • 8,439
  • 9
  • 46
  • 64