开发者

remove object from a nested array

开发者 https://www.devze.com 2023-04-02 05:09 出处:网络
I have an NSMutableArray th开发者_Go百科at contains an array inside it. the structure is like this.

I have an NSMutableArray th开发者_Go百科at contains an array inside it. the structure is like this.

pseudocode:

 myArray[0][1]

my question is how am I going to remove that object from my array? I know I can use [array removeObjectAtIndex:int] which only takes one index(or outer index for this case), but how can I remove an inner array object?


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


You'd have to do get the inner array and then remove from that inner array:

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

where i is the index to the inner array and j is the index within that inner array of the object to remove.

0

精彩评论

暂无评论...
验证码 换一张
取 消