2011-09-05 176 views
0

我有一個NSMutableArray包含一個數組。結構是這樣的。從嵌套數組中刪除對象

僞代碼:

myArray[0][1] 

我的問題是我該如何去從我的數組中刪除該對象?我知道我可以使用[array removeObjectAtIndex:int]只需要一個索引(或外部索引爲這種情況下),但我怎麼能刪除內部數組對象?

+0

看這個答案。 它可以幫助你 http://stackoverflow.com/questions/7227360/multidimensional-array-in-objective-c – PJR

+0

您還可以檢查其他線索的NSMutableArray類引用http://developer.apple。 com/library/mac /#documentation/Cocoa/Reference/Foundation/Classes/NSMutableArray_Class/Reference/Reference.html – Mahesh

回答

5
[[myArray objectAtIndex:0] removeObjectAtIndex:int]; 
+0

謝謝。這工作! – Diffy

1

你不得不做得到內陣列,然後從內部數組中刪除:

[[outer objectAtIndex:i] removeObjectAtIndex:j]; 

其中i爲索引內陣列和j是內部數組的索引要移除的對象。