0

First off, I have seen the other stack overflow answers marked as correct and none have worked for me. Clearly i'm being monumentally stupid, as I can't work out how to change the colour of the text or placeholder text in a search bar in iOS 7.

The search bar is set to 'minimal' style, and is set to display within the UINavigationBar which gives it a lovely blue tint, but the placeholder text remains grey so it's not visible. Surely there's a simple fix for this that i'm missing?

enter image description here

Sammio2
  • 7,422
  • 7
  • 34
  • 49
  • Are you creating search bar using storyboard or creating programmatically? – andrewbuilder Sep 02 '14 at 07:02
  • Currently the search bar is created in the storyboard and linked to a `UISearchDisplayController`. I have managed to change the text using key / value coding obtaining the search bar through `_searchField` and setting the `_placeholderLabel.textColor` however, this is not really App Store safe and so i'm looking for a more permanent solution! – Sammio2 Sep 02 '14 at 09:12
  • Possible duplicate of [UISearchBar text color change in iOS 7](http://stackoverflow.com/questions/19048766/uisearchbar-text-color-change-in-ios-7). Of all the solutions presented, I would recommend the answer by [Matthieu Riegler](http://stackoverflow.com/users/884123/matthieu-riegler) as being the simplest to implement, although to iterate through the search bar subviews and setting it manually is in my humble opinion more reliable long term. Also I'd recommend placing the code solution of your choice in the `viewDidLoad` TVC lifecycle method. – andrewbuilder Sep 03 '14 at 05:16
  • Forgive me for asking, but why is that KVC method not App Store safe? If that is the case, then you would be left to use the code that iterates through the search bar subviews. – andrewbuilder Sep 03 '14 at 05:22
  • It will pass validation and everything, however Apple could very well change the names of the properties being accessed by this method in future releases of iOS, this could then either break the App, or require refactoring, or both. – Sammio2 Sep 03 '14 at 11:16

0 Answers0