Change a value within a NSMutableArray

独自空忆成欢 提交于 2019-12-05 12:05:25

Take a look at the class reference instance methods:

http://developer.apple.com/library/ios/#documentation/cocoa/reference/foundation/Classes/NSMutableArray_Class/Reference/Reference.html

You can use:

replaceObjectAtIndex:withObject: given you know the index of the object. replaceObjectsAtIndexes:withObjects: to replace multiple objects at once.

Call -[NSMutableArray replaceObjectAtIndex:withObject:]. Or, if the object in the array is mutable, just grab it with -objectAtIndex: and modify its properties directly.

You would probably want to use 'replaceObjectAtIndex:withObject:' for replacing the object itself.

refer following link. It may help you

http://developer.apple.com/library/ios/#documentation/cocoa/reference/foundation/Classes/NSMutableArray_Class/Reference/Reference.html#//apple_ref/occ/instm/NSMutableArray/replaceObjectAtIndex:withObject:

From that you can use replaceObjectAtIndex:withObject: or
replaceObjectsAtIndexes:withObjects: for replacing objects.

just you have to know the index of objects.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!