Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

UITextField vs UISearchBar?

I have a collection view that I would like to be searchable. On top of this, if a user types in something that isn't in the collection view, I would like it to go ahead and search the database for it.

Currently I'm using a SearchController and am trying to heavily customize the UISearchBar that comes with a SearchController to look like this:

enter image description here

I've gotten it to look like this so far:

enter image description here

Some of the problems I'm currently running into with the UISearchBar are:

  1. Having the text initially appear on the left side before the user clicks on the search field
  2. Positioning the text in the search field to be a little lower
  3. Making the image that I replace the default search icon with not expand to the initial search icon's height (that's why it looks blurry)

Would it make more sense for me to just use a UITextField instead of a SearchController or is there a way I can replace the UISearchBar that comes with the SearchController with a UITextField?

like image 662
Thomas Avatar asked Jul 22 '15 22:07

Thomas


1 Answers

I ended up getting this to look exactly what I needed it to look like by using a UITextField, and making it work like a searchDisplayController by overriding the textFieldDidBeginEditing and textFieldDidChange methods

like image 134
Thomas Avatar answered Oct 18 '22 22:10

Thomas