无法更改iOS 7搜索栏中的文本颜色

App*_*Dev 5 textcolor uitextfield uisearchbar ios ios7

我需要更改UISearchBar文本字段中的文本颜色.我在这篇文章中尝试了两个答案:

iOS 7中的UISearchBar文本颜色更改

但文本仍保持默认的灰色.我在viewDidLoad方法中设置了该代码.我能错过什么?有人有同样的问题吗?

谢谢

Mub*_*all 2

[[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
Run Code Online (Sandbox Code Playgroud)