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
Post a Comment