Search VG Five
History
« Hiragana Go 1.0.1 Update Available | Main | App Feature: Artifice »
Thursday
Apr232009

UISearchBar - Disabling autocorrection and capitalization

One of the most basic things you don't want when searching is for the search engine to correct your search on the fly. Google does a good job with asking you if you meant a similiar spelling or choice of words, but you still want to be sure that any search term you type is the one that gets sent in the first place.

On the iPhone, the autocorrection is turned on for all text entry fields by default. Here's how to turn both autocorrection and autocapitalization off:

UISearchBar.autocorrectionType = UITextAutocorrectionTypeNo;

UISearchBar.autocapitalizationType = UITextAutocapitalizationTypeNone;

You will want to replace UISearchBar with the name of your object.

This is the default behavior that I (and I assume most users) expect when they start typing into a search bar. Of course, some programs may benefit from autocorrection.

PrintView Printer Friendly Version

EmailEmail Article to Friend

Reader Comments (1)

Also make sure to do the same in the .xib if the UISearchBar is in a nib file.

January 20, 2011 | Unregistered Commenterishank

PostPost a New Comment

Enter your information below to add a new comment.

My response is on my own website »
Author Email (optional):
Author URL (optional):
Post:
 
All HTML will be escaped. Hyperlinks will be created for URLs automatically.