2009-07-19 77 views
0

有誰知道一個快速的方法來恢復我的數組的索引,一個簡單的函數是這樣的返回指數陣列目標C

if([appDelegate.exerciseReference containsObject:aExerciseRef.IDE]) 
    { 
     //return indexofwhere the object is the same .... 
    } 

讓我們說這兩個是該指數在相同:5從我的數組中它將返回一個5整數。

回答

0

可以使用NSArrayindexOfObjectIndenticalTo:方法:最低索引的

if([appDelegate.exerciseReference containsObject:aExerciseRef.IDE]) 
{ 
    return [appDelegate.exerciseReference indexOfObjectIdenticalTo:aExerciseRef.IDE]; 
} 

它(分別爲32位或64位應用程序的intlong的typedef)返回一個NSUInteger,其中對象位於。

+0

thnx man我馬上就要測試它;) – user140983 2009-07-19 21:02:41