Question

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.

Was it helpful?

Solution

Use the NSArrayController's remove: action.

OTHER TIPS

To remove programmatically

[NSArrayController removeObjectAtArrangedObjectIndex:NSInteger];

or

[NSArrayController removeObjectAtArrangedObjectIndexes:NSIndexset];

@NewStack's answer in Swift 3:

ArrayController.remove(atArrangedObjectIndex: Int)
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top