Uisearchbar in iOS

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.