The easiest solution is to add a new button somewhere in your user interface that calls resignFirstResponder on your UITextField (or any other) when clicked. Putting this on the toolbar is problematic on the iPhone because the toolbars are usually located at the bottom of the screen and are closed by the keyboard.
A slightly more complicated solution is to place an invisible UIView behind all of your other displayed interface elements. Any taps that are not handled by your existing interface will go into this new view, which can call resignFirstResponder in the text box.
If none of these sound appeals, perhaps you should expand your question to include the type of behavior you want.
source share