jjzjj

UISearchTextField

全部标签

iOS 13 设置 UISearchTextField 占位符颜色

如何设置iOS13的UISearchTextField的占位符颜色?我尝试了以下但没有成功:searchField.attributedPlaceholder=NSAttributedString(string:"Someplaceholder",attributes:[NSAttributedString.Key.foregroundColor:UIColor.red])这是当前测试版中的错误还是我遗漏了什么?我正在使用Xcode11,beta7。 最佳答案 我发现以下代码片段有效:DispatchQueue.main.async