IOS-custom keyboard Selector

Source: Internet
Author: User

IOS-custom keyboard Selector

Target style:

Directly run the Code:
Compliance Agreement


  

Implementation Method

// Create UITextField and set setInputAccessoryView to custom Toolbar and change the keyboard style to the keyboard selector-(void) creatTextField {UITextField * textField = [[UITextField alloc] initWithFrame: CGRectMake (10, 64, [UIScreen mainScreen]. bounds. size. width-20, 44)]; [textField setInputAccessoryView: self. kbToolbar]; // custom keyboard selector UIPickerView * pickerView = [[UIPickerView alloc] initWithFrame: CGRectMake (0, 50, kScreenWidth, 320)]; [pickerView setDataSource: self]; [pickerView setDelegate: self]; // select the indicator [pickerView setShowsSelectionIndicator: YES]; // custom keyboard type [self. sourceFD setInputView: pickerView]; [textField setInputView: pickerView]; [self. view addSubview: textField];}

Implement data source and proxy Methods

# Pragma mark-UIPickerViewDelegate and UIPickerViewDataSource // must be implemented // returns the number of 'columns 'to display.-> the total number of columns in the selector! -(NSInteger) numberOfComponentsInPickerView :( UIPickerView *) pickerView {return 1;} // returns the # of rows in each component ..-> specifies the number of rows in each column of the selector! -(NSInteger) pickerView :( UIPickerView *) pickerView partition :( NSInteger) component {return 5;} // selector each row name-(NSString *) pickerView :( UIPickerView *) pickerView titleForRow :( NSInteger) row forComponent :( NSInteger) component {if (row = 0) {return @ "RMB (RMB)";} else if (row = 1) {return @ "USD (USD)" ;}else if (row = 2) {return @ "GBP (GBP)" ;}else if (row = 3) {return @ "(JPY)";} else if (row = 4) {return @ "Euro (EUR)";} else {return @".. ";}}

Related Article

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.