【问题标题】:Iterating Through an NSArray遍历一个 NSArray
【发布时间】:2010-07-06 00:49:46
【问题描述】:

谁能帮我在这里修复我的代码。我正在尝试做一些简单的迭代,遍历其中包含 NSString 的整个数组,将它们转换为 NSInteger 并将它们分配给 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;          
}  

【问题讨论】:

    标签: objective-c nsarray fast-enumeration


    【解决方案1】:
    for (NSString *string in array)
    {
      NSInteger integer = [string integerValue]; 
    }
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2011-06-19
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多