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