문제

I am new to xCode and I am trying to display the values inside my property list in a table view, but I can only show the key values. Here is my code so far, what should I tip to display the values? I have tried like 10 example codes already and still doesn't get it. Thx for any help =)

familiaEspecie is a NSDictionary, and especie is a NSMutableArray

NSBundle *bundle = [NSBundle mainBundle];
NSURL *plistURL = [bundle URLForResource:@"Animales"
                           withExtension:@"plist"]; 
NSDictionary *dictionary = [NSDictionary dictionaryWithContentsOfURL:plistURL];
self.familiaEspecie = dictionary;
especie=[[familiaEspecie allKeys]sortedArrayUsingSelector:@selector(compare:)];
도움이 되었습니까?

해결책

[familiaEspecie allValues]; should fetch you all the values in the dictionary.

If you want to retrieve the values after the sorting (based on how your keys have been sorted), you could iterate and get each value like this:

for (NSString *key in especie)
{
  id value = [self.familiaEspecie valueForKey:key];
  // Do whatever with 'value'
}
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top