2010-07-06 136 views
2

有人可以幫助我在這裏修復我的代碼。我試圖做一些簡單的迭代,通過NSString中的整個數組將其轉換爲NSIntegers,並將它們分配給一個NSInteger變量。通過NSArray迭代

for (NSInteger *itemF in myNSArray) { 
    //WHERE "slotA" is an NSInteger and "itemF" is stored as an NSString and I wanna conver to NSInteger 
    //and store is in the var. 
    slotA=itemF;   
} 

回答

6
for (NSString *string in array) 
{ 
    NSInteger integer = [string integerValue]; 
}