Sne*_*til -2 xcode uitextfield ios swift
我有一个示例登录页面。其中,我有一个文本字段。我只想更改文本字段占位符文本的 alpha 值(或不透明度)。我在谷歌上搜索但没有得到答案。请帮忙!
只需将占位符设置为属性字符串并根据需要设置颜色:
textField.attributedPlaceholder = NSAttributedString(string: "Placeholder", attributes: [NSAttributedStringKey.foregroundColor : UIColor.gray.withAlphaComponent(0.5)])
Run Code Online (Sandbox Code Playgroud)