سؤال

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?

هل كانت مفيدة؟

المحلول

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];
مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top