Created
March 13, 2011 23:27
-
-
Save mikeabdullah/868549 to your computer and use it in GitHub Desktop.
Customising object removal from NSArrayController
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- (void)willRemoveObject:(id)object; | |
{ | |
// Put your removal handling code here | |
} | |
- (void)removeObjects:(NSArray *)objects | |
{ | |
// -removeObject: calls this method internally. | |
// Iterate the objects, reporting each one | |
for (id anObject in objects) | |
{ | |
[self willRemoveObject:anObject]; | |
} | |
[super removeObjects:objects]; | |
} | |
- (void)removeObjectAtArrangedObjectIndex:(NSUInteger)index | |
{ | |
// -removeObjectsAtArrangedObjectIndexes: calls this repeatedly | |
id object = [[self arrangedObjects] objectAtIndex:index]; | |
[self willRemoveObject:object]; | |
[super removeObjectAtArrangedObjectIndex:index]; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment