2011-12-03 13 views
1

我有一個包含字典數組的plist。從NSLocalizedString插入數組中翻譯的值

例如:

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

使用NSLocalizedString,標籤被翻譯。

有了這段代碼,我把所有東西都放到了一個字典中,然後放入一個數組中。

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