码迷,mamicode.com
首页 > 移动开发 > 详细

iOS searchbar textfield placeholder color

时间:2016-05-28 17:14:56      阅读:511      评论:0      收藏:0      [点我收藏+]

标签:

 

 

// 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

标签:

原文地址:http://www.cnblogs.com/ficow/p/5537813.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!