ios - Resuable UIPickerView with delegate method -


i want have reusable uipickerview populated json object coming internet. problem how use picker , values picker in different controllers? appreciated.

for generalize picker single class there library this.

you can use actionsheetpicker requirement.

this best maintain library picker.

example code objective-c:

// inside ibaction method:  // create array of strings want show in picker: nsarray *colors = [nsarray arraywithobjects:@"red", @"green", @"blue", @"orange", nil];  [actionsheetstringpicker showpickerwithtitle:@"select color"                                         rows:colors                             initialselection:0                                    doneblock:^(actionsheetstringpicker *picker, nsinteger selectedindex, id selectedvalue) {                                       nslog(@"picker: %@, index: %@, value: %@",                                        picker, selectedindex, selectedvalue);                                     }                                  cancelblock:^(actionsheetstringpicker *picker) {                                       nslog(@"block picker canceled");                                     }                                       origin:sender]; // can use self.view if don't have sender 

hope helps show picker data in whole project.


Comments

Popular posts from this blog

javascript - Clear button on addentry page doesn't work -

c# - Selenium Authentication Popup preventing driver close or quit -

tensorflow when input_data MNIST_data , zlib.error: Error -3 while decompressing: invalid block type -