iphone - How do I add multiple components to a PickerView? -


This can be a simple question, but how do I add several components to a UIPquireview? I use NSMutableArray to populate a component but I do not know how to populate others. Whenever the row is selected I need to change the value of the label. Thanks in advance Kieran

I think you are starting a new way here to explain how to apply methods that have been properly told:

  - (NSInteger) numberOfComponentsInPickerView: (UIPickerView *) pickerView { // Return the number of components required for layers; }  

You can use other NSMutableArray to populate components. Assuming that you have 2 components, each individual NSMutableArray i.e. array1 and array2 :

  // Line counting for each component using Return - (NSINtegaor) picker view: (UIPickerView *) PickerViewsForce Encounter: (NSINtegger) component {if (component == 0) {returns [array 1 count]; } And {return [array2 count]; }} // Populate Rows of Picker - (NSString *) PickView: (UIPickerView *) pickerView titleForRow: Component for line (NSInteger): (NSInteger) component {// component 0 should load array1 value, component 1 Will be array 2 value if (component == 0) {return [array 1 object atindex: line]; } And if (component == 1) {return [array2 objectAtIndex: line]; } Return zero; }  

Use this code to replace the text of a label , when is selected value when a value is reader SelectionRow: (NSInteger) line in the component: (NSInteger) component {selectedValue.text = [NSString stringWithFormat: (NSS) @ "% @,% @", [Array 1 ObjectTime: [myPicker selected ROYInComponent: 0]], [array 2 object endx: [Marrior selected royalty: 1]]]; }

... and you are good to go :)

You may also want to look for valuable suggestions on developer programming.


Comments