How would I delete selected NSTableView row and it’s corresponding Core Data entry?
How would I delete selected NSTableView row and it’s corresponding Core Data entry?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Assuming your
NSTableViewis bound to anNSArrayController(which is the most common pattern when dealing with Core Data), you can just useNSArrayController‘sremove:method:This will delete all objects which are selected in the array controller.
Otherwise, if you’re not bound to an
NSArrayController, you’ll need to deal with the selected object directly. Without knowing how you’re populating your tableView, I can’t show all of the necessary code, but presumably you can find whichNSManagedObjectis selected. Once you have that object, it’s a cinch to delete it: