MoveArray.h@interface NSMutableArray (HF)
- (void)moveObjectFromIndex:(NSUInteger)fromIndex toIndex:(NSUInteger)toIndex;
#import "MoveArray.h"
@implementation NSMutableArray (HF)
- (void)moveObjectFromIndex:(NSUInteger)fromIndex toIndex:(NSUInteger)toIndex
{
if (toIndex != fromIndex && fromIndex < [selfcount] && toIndex< [self count]) {
id obj = [self objectAtIndex:fromIndex];[obj retain];
[self removeObjectAtIndex:fromIndex];
if (toIndex >= [self count]) {
[self addObject:obj];
} else {
[self insertObject:obj atIndex:toIndex];
}
[obj release];
}
}
@end: