Frage

I have a plist with multiple parent categories that are places and I want to allow the user to select the place and the only data from the child class of that plist are returned based on the value of a variable. What is passed into the variable will be the same as the name of the parent category. How can I retrieve different information from the plist based on the value of a variable?

War es hilfreich?

Lösung

Just create an NSDictionary that holds the plist's data, and then create an array that holds the data of the variable.

NSDictionary *dictionary = [NSDictionary dictionaryWithContentsOfFile:[[NSBundle mainBundle] 
        pathForResource:@"yourPlist" ofType:@"plist"]];
NSArray *array = [dictionary objectForKey:variable];
Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top