views:

313

answers:

1

Hi..

I`m planning to use the titles in a PSMultiValueSpecifier from settings.bundle in a pickerview. I only know how to get my selected value based on the key from the settings.bundle. Is it possible to get ALL titles based on the key ?

+1  A: 

(May be there's more elegant way). You can get settings dictionary and browse its contents (provided you know its internal structure):

NSString* listPath = [[[NSBundle mainBundle] pathForResource:@"Settings" ofType:@"bundle"] stringByAppendingPathComponent:@"Root.plist"];
NSDictionary* ttDict = [NSDictionary dictionaryWithContentsOfFile:listPath];
if (ttDict != nil){
    NSArray* prefsArray = [ttDict objectForKey:@"PreferenceSpecifiers"];
    // Next you get dictionary for required setting by its index (you should know it)
    NSDictionary* settingDict = [prefsArray objectAtIndex: index];
    NSArray* titlesArray = [settingDict objectForKey:@"Titles"]; // Voila
}

Note that titles you get this way are not localized.

Vladimir
Yea, this works like a dream, thanks! :)
Madoc