2012-12-10 48 views
-3

我是Objective C的初學者。如何從目標列表中獲取數據C

我想知道我們如何從一個對象列表[特定類的對象]中獲取數據使用for循環。

+0

「對象列表」的什麼類型的?你的問題非常模糊。 – John

+1

什麼是FlightFlight_MBOList?它採用NSFastEnumeration嗎? – vikingosegundo

回答

1

我會使用一個循環。下面是示例代碼,如果你知道一個項目的索引來完成問題

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


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

} 

,然後用

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

謝謝Ramshad ...它的工作原理... – user1765037

+0

由於我們不明白這個問題,你應該至少想象一下,列表採用NSFastEnumeration協議。在這種情況下,這是正常情況,你會建議快速枚舉。 http://developer.apple.com/library/ios/#documentation/cocoa/conceptual/objectivec/Chapters/ocFastEnumeration.html –

+0

但是,在回答之前,確實要求澄清是正確的。沒有它,問題就會被關閉,你就沒有得分也沒有威望。 –