MAFUISearchBar extends the native UISearchBar class with MAF styling capability using the MAFStyling protocol.
MAFUISearchBar *styledSearchBar = [[MAFUISearchBar alloc] initWithFrame:CGRectMake(40, 165, 250, 45)]; [mafUIView addSubview:styledSearchBar]; [styledSearchBar release]; [mafUIView release];
<Style targettype="SearchBar" key="SampleSearchBar" platform="ios"> <BackgroundImage height="30" imagesource="imageFile1.png" width="30"> <SearchBarIcon height="30" imagesource="imageFile2.png" width="30"> <SearchFieldBackgroundImage height="30" imagesource="imageFile3.png" width="30"> <Setter property="TextColor" value="#006666"> <Setter property="FontFamily" value="Helvetica-Bold"> <Setter property="FontSize" value="14"> <Setter property="BarStyle" value="1"> <Setter property="TintColor" value="#330099"> <Setter property="Translucent" value="NO"> </Style>To apply this style, set the style name of the MAFUISearchBar instance to “SampleSearchBar”:
[styledSearchBar setMafStyleName:@"SampleSearchBar"];
Background | The background image for the search bar. |
SearchBarIcon | The image to use for the search bar icon. |
FontFamily | The font family of the text in the search bar. |
FontSize | The font size of the text in the search bar. |
TextColor | The color of the text in the search bar. |
SearchFieldBackgroundImage | The image to use for the background of the search bar. |
BarStyle | The style that specifies the receiver’s appearance. Possible values: UIBarStyleDefault, UIBarStyleBlack, UIBarStyleBlackOpaque. |
TintColor | The tint color of the search bar. |
Translucent | Specifies whether the receiver is translucent. Sets the native property of the search bar. |