文本字段背景透明,但占位符文本不透明 [英] Having textfield background transparent, but placeholder text opaque

查看:33
本文介绍了文本字段背景透明,但占位符文本不透明的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

文本字段的占位符文本是否可以在其背景设置为透明时不透明,例如.如果我选择一些背景颜色,并将 alpha 设置为某个值,如下所示:

Is it possible to have a textfield's placeholder text opaque while its background is set to be transparent, eg. if I choose some background color, and set alpha to some value, like this:

占位符文本也变得透明.但我希望它不透明.那么,这是否可以实现,最好使用故事板?或者至少通过代码.

the placeholder text becomes transparent as well. But I want it opaque. So, is this achievable, preferably using storyboard ? Or at least through the code.

如果不清楚我要实现的目标,请告诉我,我会发布带有示例的图片.

If it is unclear what I am trying to achieve, just let me know , and I'll post an image with an example.

推荐答案

您可以设置颜色的透明度而不是 UITextField 的 alpha.打开颜色下拉菜单并选择其他".一个颜色选择器将打开.在颜色选择器的底部,您可以更改不透明度.

You can set the color's transparency instead of the UITextField's alpha. Open the color drop down and select "Other". A color picker will open up. At the bottom of the color picker you can change the opacity.

这篇关于文本字段背景透明,但占位符文本不透明的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆