遍历NSArray

3

有人能帮我修复我的代码吗?我试图做一些简单的事情,遍历整个包含NSString的数组,将它们转换为NSIntegers并将它们分配给一个NSInteger变量。

 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;          
}  
1个回答

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

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接