2013-03-05 148 views
0

我有這樣如何訪問`NSArray`元素

`

(lldb) po list 
(NSArray *) $1 = 0x0759f120 <__NSArrayI 0x759f120>(
{ 
EmployeeCode = 7593; 
InDate = "27/02/2013"; 
InTime = "08:11"; 
InTime2 = "00:00"; 
OutDate = "27/02/2013"; 
OutDate2 = "01/01/1901"; 
OutTime = "17:42"; 
OutTime2 = "00:00"; 
Present = 1; 
} 
) 

`

一個陣列我怎麼能每個訪問單個元素在這裏。 PLZ幫我

感謝

回答

0

NSArray包含值NSDictionary格式,所以在陣列中的每個index你會得到一個NSDictionary,這樣你就可以像這樣訪問它,

NSLog(@"Employee Code = %@", [[yourArray objectAtIndex:index] valueForKey:@"EmployeeCode"]); 

哪裏,index = 0 & index < [yourArray count]