Quantcast
Channel: Active questions tagged uipickerview - Stack Overflow
Viewing all articles
Browse latest Browse all 592

passing Json array to UIPickerView Not working

$
0
0

i get data form JSON . Like this

-(void)connectionDidFinishLoading:(NSURLConnection *)connection
{

   al=[NSJSONSerialization JSONObjectWithData:webData options:0 error:nil];
    NSLog(@"String String %@",al);

    for (array in al) {
        NSLog(@"array is  array %@",array);
    }
}

PickerView Methods:-

- (NSInteger)numberOfComponentsInPickerView:
(UIPickerView *)pickerView
{
        return 1;
}

- (NSInteger)pickerView:(UIPickerView *)pickerView
      numberOfRowsInComponent:(NSInteger)component
{
        return array.count;
}

- (NSString *)pickerView:(UIPickerView *)pickerView
titleForRow:(NSInteger)row
forComponent:(NSInteger)component
{
    return array[row];
}

I tried like this but it's showing empty PickerView.So Please give me any idea.

My Json like this:

[[1,"Hyd"],[2,"viz"]]

Viewing all articles
Browse latest Browse all 592

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>