Deleting an object in NSArrayController

0 votes
asked Jan 15, 2010 by nanochrome

I have an NSTableView which gets its data from an NSArrayController and I need to delete the currently selected row. I know NSManagedObjectContext has a deleteObject: method but, I can't think of how to delete it from the NSArrayController.

3 Answers

0 votes
answered Jan 15, 2010 by dreamlax

Use the NSArrayController's remove: action.

0 votes
answered Jan 4, 2012 by newstack

To remove programmatically

[NSArrayController removeObjectAtArrangedObjectIndex:NSInteger];

or

[NSArrayController removeObjectAtArrangedObjectIndexes:NSIndexset];
0 votes
answered Sep 15, 2017 by styl3r

@NewStack's answer in Swift 3:

ArrayController.remove(atArrangedObjectIndex: Int)
Welcome to Q&A, where you can ask questions and receive answers from other members of the community.
Website Online Counter

...