You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
28 lines
568 B
28 lines
568 B
|
|
// |
|
// NSMutableArray+convenience.m |
|
// |
|
// Created by in 't Veen Tjeerd on 5/10/12. |
|
// Copyright (c) 2012 Vurig Media. All rights reserved. |
|
// |
|
|
|
|
|
|
|
#import "NSMutableArray+convenience.h" |
|
|
|
@implementation NSMutableArray (Convenience) |
|
|
|
- (void)moveObjectFromIndex:(NSUInteger)from toIndex:(NSUInteger)to |
|
{ |
|
if (to != from) { |
|
id obj = [self objectAtIndex:from]; |
|
[self removeObjectAtIndex:from]; |
|
if (to >= [self count]) { |
|
[self addObject:obj]; |
|
} else { |
|
[self insertObject:obj atIndex:to]; |
|
} |
|
} |
|
} |
|
|
|
@end
|
|
|