[英]Retrieve elements from an array in a dictionary
我是目標 C 的新手,我真的需要幫助解決以下問題。 我有一個字典 userDetails 包含數組 userAttributes
int y=0;
for (int z=0;z<noOfNeighbours;z++) {
NSMutableArray *userAttributes = [userDetails objectForKey:[employeeID objectAtIndex:z]];
[userAttributes addObject:[NSString stringWithFormat:[myArrayOne objectAtIndex:17+y]]];
[userAttributes addObject:[NSString stringWithFormat:[myArrayOne objectAtIndex:18+y]]];
[userAttributes addObject:[NSString stringWithFormat:[myArrayOne objectAtIndex:22+y]]];
y=y+17;
//NSLog(@"%@",[userAttributes objectAtIndex:0]);
}
其中 myArrayOne 是一個包含所有信息的字符串數組。 我使用employeeID 數組作為鍵。 如何檢索存儲在數組中特定鍵的信息? 提前致謝。
如果要根據鍵檢索信息,首先將其存儲在字典而不是數組中。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.