I have a NSMUtableArray
which has elements, for example:
a,b,c,e
And I want to add an object d
to behind c
and befor
I'd just add the new object at either end and sort the array again. If the array you're adding to is already sorted, the re-sort that moves one object is going to be about as quick as anything you'd implement yourself.
NSMutableArray *things; // populated
id newObject;
...
[things addObject:newObject atIndex:0];
[things sortUsingSelector:@selector(compare:)];