简体   繁体   English

iOS在褪色的白色背景上显示强烈的白色文字?

[英]iOS Strong white text on faded white background?

I have a subview with a white background and low alpha value (.2) and this subview includes several UILabel elements that have their text set to white and their alpha values set to 1. I cannot see the text. 我有一个带有白色背景和低Alpha值(.2)的子视图,该子视图包含几个UILabel元素,这些元素的文本设置为白色,Alpha值设置为1。我看不到文本。 If I change the text color it works fine, and I can see the text at full alpha as desired. 如果我更改文字颜色,则效果很好,并且可以根据需要以全字母显示文字。 I have tried changing the subview's background to gray, but I continue not to be able to see the white text. 我尝试将子视图的背景更改为灰色,但是我仍然无法看到白色文本。 How can I achieve the effect of strong white text on a faded white background? 如何在褪色的白色背景上获得强白色文本的效果?

If you set the alpha value of a control, all sub controls are also drawn with that value. 如果设置控件的Alpha值,则所有子控件也将使用该值绘制。 What you want is to change the background color to have low alpha, so it will be translucent, but everything inside the control will still have total opacity. 您想要的是将背景颜色更改为较低的Alpha,因此它将是半透明的,但是控件内的所有内容仍将具有完全不透明度。

Also the control has to be on top of something else than white background, otherwise it will just be white. 此外,控件还必须位于白色背景以外的其他东西之上,否则它将只是白色。

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

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