Attention:
1. You need to specify the data source object and the proxy object before using Pickerview.
2. Need to use up to two protocols: Uipickerviewdatasource, Data source protocol, uipickerviewdelegate Proxy Protocol
First, Uipickerview the steps to display the data
1. Lazy Loading of plist files
2. Set the controller to be the current Uipickerview data source object and proxy object
3. Implementing the Data source method Numberofcomponentsinpickerview Returns the number of columns
4. Implement the data source method Pickerview:numberofrowsincomponent Returns the number of rows per column
5. Implement proxy method Pickerview:titleforrow:, returns the data contents of each row
6. Listen for Uipickerview selection events to display the currently selected item on the specified label
Second, the active setting Uipickerview Select an item
Call Uipickerview's selectRow:inComponent:animated: method to set an item to be selected.
Note: When the selectRow:inComponent:animated: method is completed, the system does not actively invoke the Uipickerview proxy-(void) Pickerview: (Uipickerview *) Pickerview Didselectrow: (Nsinteger) Row incomponent: (Nsinteger) component method, so to make the label change, you must call the method manually.
Three, Uipickerview method of reloading
-(void) reloadallcomponents;
-(void) Reloadcomponent: (Nsinteger) component;
The above two methods represent a re-refresh of the data, that is, the data source method and the proxy method are recalled.
Iv. Finally, I would like to add that random numbers are generated
Arc4random ()
C Language Functions
Randomly generates an unsigned integer (0 or all positive integers)
Randomly generates a number between the 0–n
Arc4random ()% (n + 1)
Arc4random_uniform (12)
Uipickerview Basic Use Method