-3

我是Objective C的初学者。

我想知道我们如何通过使用 for 循环从对象列表中获取数据[特定类的对象]。

4

1 回答 1

1

I would use a loop. Here is the sample code to accomplish the problem

for(int itemIndex = 0;itemIndex < yourCollectionCount; itemIndex++){


    id myObject = yourCollection objectAtIndex:itemIndex]; //replace id  with your Collection Individual Item dataType

}

or

If you know the index of item, then use

id myObject = yourCollection objectAtIndex:knownIndex]; //replace id  with your Collection Individual Item dataType
于 2012-12-10T05:26:21.557 回答