简体   繁体   English

UIImagePicker 更改搜索栏占位符文本的颜色

[英]UIImagePicker change color of searchbar placeholder text

How to change the color of the placeholder text of an UIImagePicker?如何更改 UIImagePicker 的占位符文本的颜色? Preferably without using -appearance proxy.最好不使用 -appearance 代理。 I am refering to the placeholder text in the search textfield.我指的是搜索文本字段中的占位符文本。 (Photos, People... text) (照片、人物……文字) 在此处输入图像描述

Alternatively how can I get the searchbar not to show up at all?或者,我怎样才能让搜索栏根本不显示? The colors for the background were set via appearance proxy.背景的 colors 是通过外观代理设置的。

You achieve placeholder color using this function.您可以使用此 function 获得占位符颜色。

let imagePicker = UIImagePickerController()
imagePicker.navigationBar.isTranslucent = false
imagePicker.navigationBar.barTintColor = .blue
imagePicker.navigationBar.tintColor = .white
imagePicker.navigationBar.titleTextAttributes = [
        NSAttributedString.Key.foregroundColor: UIColor.white
]

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

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