简体   繁体   English

UItextfield不呈现背景色

[英]UItextfield not rendering background color

When UITextfield is visible on viewdidload method, It's background color is visible. 当UITextfield在viewdidload方法上可见时,它的背景色也可见。 However, If the text field is kept hidden until some event occurs, It's background color is not visible. 但是,如果在发生某些事件之前将文本字段保持隐藏状态,则它的背景色不可见。 In the image, I have given text field white color background with an alpha value. 在图像中,我为文本字段指定了带有alpha值的白色背景。 In first case color is visible, however in the second case, background color seems to be the clear color. 在第一种情况下,颜色是可见的,但是在第二种情况下,背景颜色似乎是纯色。

These text fields are inside UIStackView. 这些文本字段位于UIStackView中。

透明背景色可见的背景色

When textfield is in stackView call 当textfield在stackView调用中时

  self.field1.isHidden = false

  self.field1.setNeedsDisplay()

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM