From iPhone Development Wiki
UISearchBar is a rounded text field which a search icon.
Examples of some UISearchBars. Top: having custom backgroundImage, contentInset and modified cancelButton. Bottom: usesEmbeddedAppearance
More control on appearance
The SDK only provides methods to change the search bar's tint color, but there are undocumented methods for stronger controls.
usesEmbeddedAppearance
| Signature
| @property(nonatomic,assign) BOOL usesEmbeddedAppearance;
|
| Available in
| 3.0 –
|
Setting this property to true will make the search bar appear as embedded, like within MobileMail.
backgroundImage
| Signature
| @property(nonatomic,retain) UIImage* backgroundImage;
|
| Available in
| 3.0 –
|
Use this property to set any background for your search bar. Note that the image is always scaled, even if you make a stretched copy.
contentInset
| Signature
| @property(nonatomic,assign) UIEdgeInsets contentInset;
|
| Available in
| 3.0 –
|
Set the padding between the text field and the background. Default is {0, 5, 0, 5}.
cancelButton, searchField
| Signature
| @property(nonatomic,retain) UINavigationButton* cancelButton;
|
| Available in
| 3.0 –
|
| Signature
| @property(nonatomic,readonly) UITextField* searchField;
|
| Available in
| 3.0 –
|
The cancel button and the text field can also be customized. In particular, the searchField's rightView is that bookmark button, which you can replace with your own.
References