2011-09-19 73 views

回答

3

的NSArray(和其他Objective-C的容器)解釋存儲對象,所以你需要創建的NSNumber對象將其存儲在陣列:

NSNumber *num = [NSNumber numberWithInt:index]; 
[yourMutableArray addObject:num]; 

也看看NSIndexSet(NSMutableIndexSet)類 - 可能是他們將更好地爲您的目的服務

+0

而你也可以獲得存儲的索引,如int value = [[yourMutableArray objectAtIndex:index] intValue]; – Mahesh

+0

thankz ....這是有益的@Vladimir –

0

您可以將NSIndexPath存儲在數組中。

+0

這幫了很多.... thankz –

0

你是什麼數組? 你可以在你的h中創建。 :NSInteger arr [10]; //使陣列尺寸10

,然後用您的值填充: 對(INT I = 0;我< 10;我++){ARR [I] = 1} 例如..