I’m extracting some string data from a plist:
<dict>
<key>Feb 7, 2000</key>
<array>
<string>7</string>
<string>8</string>
</array>
<key>Jan 27, 2001</key>
<array>
<string>8</string>
<string>7</string>
</array>
and using the following code to output the data in a UILabel:
NSString * myString = [NSString stringWithFormat:@"%@",self.data];
myLabel.text = myString;
the output is being displayed as ( 7, 8)
does anyone know how i might go about removing the parenthesis and comma. and also separating the values so I could display something like first: 7 second: 8
Example:
Code:
Output:
EDIT (response to comment)
First you need to determine the keys within the
NSMutableDictionary.Load the
.plistfile, loop through and add the keys to anNSMutableArray.Make sure the array can be accessed by the
UIPickerView.The
UIPickerViewshould be able to retrieve the keys like this:Finally, update the
UILabellike this:The
UIPickerViewnow contains the following rows:When for example “Jan 27, 2001” is selected, the
UILabelshows: