Search code examples
iosobjective-cuipickerview

Issue in picker in iOS?


I am using IQActionSheetPickerView in my project.For single picker it ask for NSArray like below

[picker setTitlesForComponents:@[@[@"First", @"Second", @"Third", @"Four", @"Five"]]];

but i have a array which gets value from server so can't make it static.So i have used a NSMutableArray whose values are fetched from server & added to array so how can i use dynamic array in picker.

Thanks in advance


Solution

  • This seems too obvious but I think your question is how to pass the NSMutableArray filled with the values from the server to the picker.

    NSMutableArray *serverData = ... // values from the server
    [picker setTitlesForComponents:@[ serverData ]];
    

    Is that what you are asking for? I'm assuming you have one array for one component.