2011-09-05 178 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是内部数组的索引要移除的对象。