2011-12-03 5 views
1

私は辞書の配列を持つplistを持っています。NSLocalizedStringから配列に変換された値を挿入します

例:NSLocalizedStringを用い

items: (array) 
    item0: (dictionary) 
     Label: (string) 
     Img: (string) 
    item1: (dictionary) 
     Label: (string) 
     Img: (string) 

は、ラベルが翻訳されます。

このコードでは、すべてを辞書に入れてから配列にします。

NSString *myFile = [[NSBundle mainBundle] pathForResource:@"test" ofType:@"plist"]; 

NSDictionary *dict = [[NSDictionary alloc]initWithContentsOfFile:myFile]; 

NSMutableArray *arr = [[NSMutableArray alloc] initWithArray:[dict objectForKey:@"Items"]]; 

ただし、配列に配置する方法はありますが、値はキーではなく直接変換されますか?

ありがとうございます!

答えて

0

方法について:

NSMutableArray * arr = [[NSMutableArray alloc] initWithArray: [dict allValues]]; 
+0

おかげで、それは私が探していたものではないのです – Vins

関連する問題