OBJECTIVE-C Study notes: Basic use of Uipickerview and Uidatepicker

Source: Internet
Author: User

1.UIPickerView

1.1. Common Properties of Uipickerview


//data source (used to tell Uipickerview how many columns there are rows)@property (nonatomic,assign)ID<UIPickerViewDataSource>DataSource;//agent (used to tell Uipickerview what to display on every 1 rows of every 1 columns, listen for Uipickerview selection)@property (nonatomic,assign)ID<UIPickerViewDelegate>Delegate;//do you want to display the selected indicator@property (nonatomic) BOOL showsselectionindicator;//How many columns are there altogether?@property (nonatomic,ReadOnly) Nsinteger numberofcomponents;

1.2. Common methods of Uipickerview


re-refresh all columns -(void) reloadallcomponents; // re-refresh column component -(void) reloadcomponent: (Nsinteger) component;
// the first row of column component -(void) SelectRow: (Nsinteger) Row incomponent: (Nsinteger) component Animated: (BOOL) animated; // get the currently selected line number of column component -(Nsinteger) Selectedrowincomponent: (Nsinteger) component;

1.3. Uipickerviewdatasource (data source method)


Total number of columns -(Nsinteger) Numberofcomponentsinpickerview: (Uipickerview *) Pickerview; // column component number of lines -(Nsinteger) Pickerview: (Uipickerview *) Pickerview numberofrowsincomponent: ( Nsinteger) component;

1.4. Proxy method (Uipickerviewdelegate)


//What is the width of column component?-(CGFloat) Pickerview: (Uipickerview *) Pickerview widthforcomponent: (nsinteger) component;//What is the row height of column component ?-(CGFloat) Pickerview: (Uipickerview *) Pickerview rowheightforcomponent: (nsinteger) component;//what text is displayed in column component row-(NSString *) Pickerview: (Uipickerview *) Pickerview Titleforrow: (nsinteger) Row forcomponent: (Nsinteger) component;//section component row row shows what view (content)-(UIView *) Pickerview: (Uipickerview *) Pickerview Viewforrow: (nsinteger) Row forcomponent: (Nsinteger) component Reusingview: (UIView *) view;//column component row of Pickerview was selected- (void) Pickerview: (Uipickerview *) Pickerview Didselectrow: (nsinteger) Row incomponent: (Nsinteger) component;

2. Uidatepicker

2.1. Common Properties


datepicker display mode @property (nonatomic) Uidatepickermode Datepickermode; // displays the regional language @property (nonatomic, retain) Nslocale *locale;

2.2. Monitor the selection of Uidatepicker

* Because Uidatepicker inherits from Uicontrol, it can be passed Addtarget: Listen

OBJECTIVE-C Study notes: Basic use of Uipickerview and Uidatepicker

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.