jun 2011

Show me if it works

In my current project I needed to use a SearchBar. The standard UISearchBar in UIKit is working fine but it lacks some user feedback. When a search is performed the user ought to have some kind of feedback. Especially when the search is performed over the internet and the mobile net. So including an UIActivityView in the search bar was a natural extension.

Fortunately someone on ‘StackOverflow’ had asked for this before. The answer on the question pointed out how to get hold of the UITextField inside the UISearchBar, because there isn’t any property for it.

The only problem I had with this was a UX one: Should the UIActivityIndicator sit on the left or the right side in the textfield? On the left there is an icon showing a magnifying glass and on the right is the clear button and if needed the bookmark button. So which of these icons is to be gone hidden during the actual search. Since the left one wasn’t a button I choose that side, but if the Magnifying glass is a search option popup maybe it would maybe be better having it on the other side. Please let me know what you think.

I have put the simple subclass of UISearchBar on GitHub here. It’s named OOSearchBar and has two methods startAnimating: and stopAnimating:, use them in the UISearchBarDelegate methods.
Comments