2009-07-19 74 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