IOS UI Learning Uisearchbar

Source: Internet
Author: User

Uisearchbar inherit from UIView, Uiresponder, NSObject

Uisearchbar Property settings

Code

1-(void) Createsearchbar2 {3_searchbar = [[Uisearchbar alloc] Initwithframe:cgrectmake (0,0, [UIScreen Mainscreen].bounds.size.width, +)];4     //Setting Control Styles5_searchbar.barstyle =uisearchbarstyleprominent;6     7     //Automatic Case setting of text objects8     //contains four types of9     /*Ten typedef ns_enum (Nsinteger, uitextautocapitalizationtype) { One Uitextautocapitalizationtypenone, A Uitextautocapitalizationtypewords, - Uitextautocapitalizationtypesentences, - Uitextautocapitalizationtypeallcharacters, the     }; -     */ -_searchbar.autocapitalizationtype =Uitextautocapitalizationtypenone; -      +     //automatic error correction of input text -     //altogether three kinds +     /* A typedef ns_enum (Nsinteger, uitextautocorrectiontype) { at Uitextautocorrectiontypedefault, - Uitextautocorrectiontypeno, - Uitextautocorrectiontypeyes, -     } -     */ -_searchbar.autocorrectiontype =Uitextautocorrectiontypedefault; in      -     //Control background picture to_searchbar.backgroundimage = [UIImage imagenamed:@""]; +      -     //The right side of the control displays a Cancel button displayed by default the_searchbar.showscancelbutton =YES; *      $     //displays a search results button at the right end of the controlPanax Notoginseng_searchbar.showssearchresultsbutton =YES; -      the     //whether the search results button is selected +_searchbar.searchresultsbuttonselected =NO; A  the     //a button on the right side of the control that displays a book disappears when you enter text +_searchbar.showsbookmarkbutton =YES; -      $     //text displayed above the control $     //_searchbar.text = @ "2"; -      -     //set whether a control has a pivot effect the_searchbar.translucent =NO; -     Wuyi     //Set placeholder text (hint text) to disappear when you enter text the_searchbar.placeholder =@"Please enter text"; -      Wu     //Set the keyboard style when typing -_searchbar.keyboardtype =Uikeyboardtypenumberpad; About      $     //set a line of prompt text that appears at the top of the control -_searchbar.prompt =@"I am Searchbar"; -      -     //set the color of bar A_searchbar.tintcolor =[Uicolor Greencolor]; +     //set up proxy <UISearchBarDelegate> the_searchbar.Delegate=Self ; -      $     //The contents of the selection bar array below the search bar are the caption of the button the     //_searchbar.scopebuttontitles; the      the     //The number of selection bar buttons below the search bar the_searchbar.selectedscopebuttonindex =3; -      in     //whether to display the selection bar below the search bar needs to be set to Yes to use Scopebar the_searchbar.showsscopebar =YES; the      AboutSelf.navigationItem.titleView =_searchbar; the}

Uisearchbar does not perform search behavior, you must use delegate, and when you enter search text, click a button, or gesture, the proxy method completes the search action.

Not to be continued

IOS UI Learning Uisearchbar

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.