- (void)moveArrayItemFromIndex:(int)fromIndex toIndex:(int)toIndex{
NSMutableArray *array = @[@"0",@"1",@"2",@"3",@"4",@"5",@"6",@"7",@"8",@"9"].mutableCopy;
NSString *str = array[fromIndex];
NSInteger currentIndex = fromIndex;
if (fromIndex <= toIndex) {
for (int i=fromIndex; i<toIndex; i++) {
currentIndex = [array indexOfObject:str];
if (currentIndex < toIndex) {
[array exchangeObjectAtIndex:currentIndex withObjectAtIndex:currentIndex + 1];
currentIndex++;
}
}
}else{
for (int i=fromIndex; i>toIndex; i--) {
currentIndex = [array indexOfObject:str];
if (currentIndex > toIndex) {
[array exchangeObjectAtIndex:currentIndex withObjectAtIndex:currentIndex - 1];
currentIndex--;
}
}
}
NSLog(@"%@",array);
}