Skip to content

Instantly share code, notes, and snippets.

@peerasak-u
Created October 25, 2013 08:42
Show Gist options
  • Select an option

  • Save peerasak-u/7151506 to your computer and use it in GitHub Desktop.

Select an option

Save peerasak-u/7151506 to your computer and use it in GitHub Desktop.
// Initialize Array
NSMutableArray *dumbArray = [NSMutableArray new];
// Basically addObject
[dumbArray addObject:@"A"];
[dumbArray addObject:@"B"];
[dumbArray addObject:@"C"];
[dumbArray addObject:@"D"];
// Insert Object at the top array
[dumbArray insertObject:@"0" atIndex:0];
// Create Array And IndexSet
NSArray *dumbArray2 = @[@"-3", @"-2", @"-1"];
NSIndexSet *dumbIndexSet = [NSIndexSet indexSetWithIndexesInRange:NSMakeRange(0, [dumbArray2 count])];
// Insert Array at the top of array
[dumbArray insertObjects:dumbArray2 atIndexes:dumbIndexSet];
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment