How to populate data from web service in UIPickerView? [IOS Application Development]

Does anyone know how to populate, for example, a list of categories, from a web service in a UIPickerView? Also, is it possible to put a hidden value?

Example,
"Public" with hidden identifier "1",
"Member" with hidden identifier "2", etc.

These 2 values ​​must be from a web service. By the way, I am using the ASIHTTPRequest structure.

I am new to iOS / Xcode / Objective C. Hope someone can help): Thanks.

================ Answer ================== <

@MSgambel
Okay, try to explain everything to me. At the moment, how we put elements in a UIPickerView:

[NSArray arrayWithObjects: @ "John Appleseed", @ "Chris Armstrong", @ "Serena Auroux", @ "Susan Bean", @ "Luis Becerra", @ "Kate Bell", @ "Alain Brier", zero];

instead of these elements above, how can I populate elements from a web service in the collector?

@Akshay
What I mean by hidden is that the collector will have 2 values, but only the "Public" label is visible on the collector and not on the "1" icon. I would like to implement it somewhat similar to the drop down menu on websites.

"" :
DomainID: DomainName
1:
2:
3: CompanyB
"", DomainID. ( )


"" , , "1" . , ​​?

+5
2

, -. , SOAP, sudzc wsd2lobjc. , WSDL Objective C.

UIPickerView, . a NSArray NSDictionaries. ( , ):

NSDictionary *dictOne = [NSDictionary dictionaryWithObjectsAndKeys:@"1",@"realValue",@"Public",@"looksGoodValue",nil]; NSDictionary *dictTwo = [NSDictionary dictionaryWithObjectsAndKeys:@"2",@"realValue",@"CompanyA",@"looksGoodValue",nil]; NSDictionary *dictTre = [NSDictionary dictionaryWithObjectsAndKeys:@"3",@"realValue",@"CompanyB",@"looksGoodValue",nil];

array = [NSArray arrayWithObjects:dict1,dict2,dict3,nil];

UIPickerViewDelegate

- (NSString *)pickerView:(UIPickerView *)pickerView titleForRow:(NSInteger)row forComponent:(NSInteger)component {

return [[self.array objectAtIndex:row] objectForKey:@"looksGoodValue"];

}

, , , pickerview (, -)

request.realValue = [[self.array objectAtIndex:[pickerView selectedRowInComponent:0]] valueForKey:@"realValue"];

, !

+1

, ASIHTTPRequest.

`NSArray * paths = NSSearchPathForDirectoriesInDomains (NSDocumentDirectory, NSUserDomainMask, YES);

NSString * documentsDirectory = [paths objectAtIndex: 0];

NSString * path = [documentsDirectory stringByAppendingPathComponent: @ "data.plist" ];

NSMutableArray * array = [[NSMutableArray alloc] init]; [array addObject: [NSArray arrayWithObjects: [NSString stringWithFormat: @ "% @", stringOne],// , nil]]; [array writeToFile: : YES]; `

[NSMutableArray alloc] initWithContentsOfFile:path] pickerView.

0

All Articles