有人可以帮我修复我的代码吗?我试图做一些简单的迭代遍历整个数组,其中包含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;
}
答案 0 :(得分:7)
for (NSString *string in array)
{
NSInteger integer = [string integerValue];
}