I have NSMutableArray
. There are for example such objects: 0, 1, 2.
How can I replace object 0
into index where object 2
. In result I want array with objects: 1, 2, 0. Thanks.
@trojanfoe, there is a simple mistake in your answer.
The first line of the code does not return anything as per doc. So it should be,
id object = [[array objectAtIndex:0] retain];
[array removeObjectAtIndex:0];
[array insertObject:object atIndex:2];
[object release];
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With