从嵌套数组中删除对象
问题描述:
我有一个NSMutableArray包含一个数组。结构是这样的。从嵌套数组中删除对象
伪代码:
myArray[0][1]
我的问题是我该如何去从我的数组中删除该对象?我知道我可以使用[array removeObjectAtIndex:int]只需要一个索引(或外部索引为这种情况下),但我怎么能删除内部数组对象?
答
你不得不做得到内阵列,然后从内部数组中删除:
[[outer objectAtIndex:i] removeObjectAtIndex:j];
其中i为索引内阵列和j是内部数组的索引要移除的对象。
看这个答案。 它可以帮助你 http://*.com/questions/7227360/multidimensional-array-in-objective-c – PJR
您还可以检查其他线索的NSMutableArray类引用http://developer.apple。 com/library/mac /#documentation/Cocoa/Reference/Foundation/Classes/NSMutableArray_Class/Reference/Reference.html – Mahesh