Why does UISearchDisplayController suck!?
I’ve been working recently on a project that uses search. Not filtering, mind you, search! I’ve come to the conclusion that UISearchDisplayController is a bitch. Excuse my language but developers aren’t the most patient people anyway.
So why does it suck? Because it doesn’t perform search. It performs filtering but has search in it’s name wrongly! Many other sources have covered this misconception.
UISearchBar: (wanted to stick in a pretty photo)

Most of what you see on the iPhone isn’t actually searching, UITableView’s usually contain a number of results and the search bar will merely filter those results. That’s what UISearchDisplayController does, it facilitates the filtering of your existing UITableViewDataSource.
Search is usually asynchronous, usually relying on a server or local database where results are parsed in some manner and returned and displayed all at once. Because of the lag time for all of that stuff to happen to actually “search”, most system’s can’t have live filtering of results. Live filtering would require every result to be available at a moments notice.
UITableView is a highly optimized class, it’s essentially infinite because as you scroll down it simply releases the memory it used for cells on the top and asks the UITableViewDataSource instance for cells going to arrive a head of time. Also it doesn’t even go through the alloc/init cycle and release cycle for really any UITableViewCell’s. Instead it simply takes one’s you scrolled by (not seen anymore) and reuses them. So if a data source can provide infinite (sidenote I like physics and hate using infinite in any computable sense but o well) amounts of data, you can essentially scroll through it all.
So here’s the steps I’m taking to do a search as most other app developers would. Even Apple does, go search the App Store, there’s latency between typing and hitting “Search”. Usually it can get an index of suggestions pretty quickly but once you hit search it brings up a loading screen while it fetches the results.
- UISearchBar becomes first responder (lamen: activated)
- User types full search term
- User hits “Send” button on keyboard (here “Send” should change to “Done” to dismiss keyboard since hitting “Send” again doesn’t do anything
????Profit …..sorry I had too, I’m being serious though- After server interaction, results are received and parsed through (Should show some form of loading or activity while this is going on)
- Display results.
See you have to go through all of those steps to perform a search.
Safari (before 3.x or iOS4 or something) used proper search through this class no less. It kept the content area lightly blackened and let you type your search term[s] and hit search and it would take you to google. Now it has search suggestions there but principal is the same.
Here’s what it looks like for filtering
- UISearchBar becomes first responder;
- User types a letter (Data is adjusted accordingly, displayed)
- Go to Step 2 (loop)
A good example of this is the Contacts app. It’s search filters the results. And here’s one thing I won’t understand of that ideology.

Why is there a “Search” button on the lower right? It should read “Done” because all it does is dismiss the keyboard. That’s one fundamental aspect of this redefinition of “Search” that UISearchDisplayController has created.
That’s why it sucks.
I’m working on a way to make it work like Safari, that’s what I’m going for.