I'm looking for an easy solution to delete NSTableView rows by pushing the delete key.
All I have seen when searching in Google were answers like this: http://likethought.com/lockfocus/2008/04/a-slightly-improved-nstableview/
This seems to me an Engineering solution, but I would like to know if this is the best way. Does any one know a better answer?
There is no need to subclass and catch keyDown
in NSViewController
.
The Delete
menu item in the menu Edit
is connected to the selector delete:
of First Responder. If there is no Delete
menu item, create one and connect it to delete:
of First Responder (red cube).
Delete
menu item (⌫ or ⌘⌫)In the view controller implement the IBAction
method
Swift: @IBAction func delete(_ sender: AnyObject)
Objective-C: -(IBAction)delete:(id)sender
and put in the logic to delete the table view row(s).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With