Question

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?

Was it helpful?

Solution

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];
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top