iOS searchbar textfield placeholder color
Posted Ficow Shen
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了iOS searchbar textfield placeholder color相关的知识,希望对你有一定的参考价值。
// Get the instance of the UITextField of the search bar UITextField *searchField = [searchBar valueForKey:@"_searchField"]; // Change search bar text color searchField.textColor = [UIColor redColor]; // Change the search bar placeholder text color [searchField setValue:[UIColor blueColor] forKeyPath:@"_placeholderLabel.textColor"]; //Change search bar icon if needed [self.searchBar setImage:[UIImage imageNamed:@"searchIcon"] forSearchBarIcon:UISearchBarIconSearch state:UIControlStateNormal]; [self.searchBar setValue:[UIColor whatever] forKeyPath:@"_searchField._placeholderLabel.textColor"];
以上是关于iOS searchbar textfield placeholder color的主要内容,如果未能解决你的问题,请参考以下文章