我需要更改UISearchBar
文本字段中的文本颜色。我在这篇文章中尝试了两个答案:
但文本仍保持其默认的灰色。我在方法中设置了该代码viewDidLoad
。我能错过什么?有人有同样的问题吗?
谢谢
我需要更改UISearchBar
文本字段中的文本颜色。我在这篇文章中尝试了两个答案:
但文本仍保持其默认的灰色。我在方法中设置了该代码viewDidLoad
。我能错过什么?有人有同样的问题吗?
谢谢
// Get the instance of the UITextField of the search bar
UITextField *searchField = [self.searchBar valueForKey:@"_searchField"];
// Change search bar text color
searchField.textColor = [UIColor blueColor];
[[UITextField appearanceWhenContainedIn:[UISearchBar class], nil] setTextColor:[UIColor blueColor]];
//This is done in Xcode 5.0 and its working btw i don't know whether it works with previous versions of Xcode or not....
// Also I wrote this method in viewDidLoad