1

For example, I have arrays embedded inside array [["A", 4], ["B", 5]], and I would like to update the element inside the first embedded array so that the final outcome because [["A", 5], ["B", 5]], and not [["A", 4], ["B", 5], ["A", 5]].

4

1 回答 1

0

在替换数组的值之前,请确保您有NSMutableArray (mutable)?否则你会得到错误:

是的,NSMutableArray然后我遵循了我的建议:(这里我给出简单的基本逻辑)

要替换特定索引处的任何值NSMutableArray,请使用replaceObjectAtIndex:withObject:

例如

[MyArrayName replaceObjectAtIndex:0 withObject:MyValues];

应用这个逻辑:

于 2013-08-24T05:26:07.347 回答