Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on Apr 28th, 2012  |  syntax: None  |  size: 0.39 KB  |  hits: 11  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. Re-index sorting with Core Data, NSTreeController and NSOutlineView
  2. - (void)reIndex {
  3.     NSUInteger count = [[_arrayController arrangedObjects] count];
  4.     NSArray *array = [NSArray arrayWithArray:[_treeController arrangedObjects]];
  5.  
  6.     for (int i = 0; i < count; i++) {
  7.         id item = [array objectAtIndex:i];
  8.         [item setValue:[NSNumber numberWithInt:i] forKey:@"sortIndex"];
  9.     }
  10. }