I used some thing like this and worked with me:
[[UIBarButtonItem appearanceWhenContainedIn: [UISearchBar class], nil] setTintColor:[UIColor blackColor]];
it changed the cancel button color to black.
Update for iOS 9.0, the method appearanceWhenContainedIn
is deprecated, use appearanceWhenContainedInInstancesOfClasses
instead:
[[UIBarButtonItem appearanceWhenContainedInInstancesOfClasses:@[[UISearchBar class]]] setTintColor:[UIColor blackColor]];
And in Swift 3:
UIBarButtonItem.appearance(whenContainedInInstancesOf:[UISearchBar.self]).tintColor = UIColor.black
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…