Search functionality is used in most apps, so the search function cannot be implemented without the Uisearchbar control.
Uisearchbar inherits from UIView, the following is a brief description of its properties and methods.
uisearchbar *searchbar = [[uisearchbar alloc]init];
Searchbar. frame = CGRectMake(0, 0, +);// initialization method
[Searchbar setplaceholder:@ ' search '];//set placeholder text
[Searchbar setbartintcolor: [uicolor orangecolor]];//Set the background color here
Of course some people write this: [Searchbar settintcolor: [uicolor orangecolor]]; But according to the document, this method no longer affects the bar background color after iOS7
[Searchbar settranslucent:YES];//set is transparent
[Searchbar Setshowssearchresultsbutton:YES]; whether to display the search results button
This is the button that will enlarge the search results.
[Searchbar setsearchtextpositionadjustment:uioffsetmake(30, 0)];//set the text offset of the Chinese text box in the search box
Uisearchbar in iOS