I’m building an application that inserts records into a database, and it pulls items from that database from lookup tables so it has the proper items in predefined fields. Obviously a picker is the best route for this method, but I’m running into a problem. There are 2 different pages with about 15 different pickers between the two of them. Now what I need to do is load the picker as it’s popped up when the user selects the field.
All the online tutorials and examples I’ve found are using either the GUI editor to link a picker with a data source, or using one single data source for a picker in a separate file(which I’m not doing).
How do I go about loading an NSMutableArray into a picker when it’s called?
Thanks!
Have a data source and delegate class that implements all the required data source/delegate methods, that is defined as conforming to
UIPickerViewDataSourceandUIPickerViewDelegateand that has@property (retain, nonatomic) NSMutableArray *dataArray;defined in the header. Make the data source/delegate class’s methods (such as- (NSString *)pickerView:(UIPickerView *)pickerView titleForRow:(NSInteger)row forComponent:(NSInteger)component) load the strings etc fromdataArray. Then when creating/changing the picker, do the following:Hope this is all clear!