• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: activating Delete menu item through binding
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: activating Delete menu item through binding


  • Subject: Re: activating Delete menu item through binding
  • From: Quincey Morris <email@hidden>
  • Date: Sat, 21 Apr 2012 20:01:34 -0700

On Apr 21, 2012, at 19:18 , Koen van der Drift wrote:

> So, I solved it as follows. I created a deleteObjects IBAction in my AppController class invoked by the delete menuItem. To remove the objects, I am more or less following the code in Hillegass' book, chapter 15 on NSAlerts.   In this example, the line
>
> [employeeController remove: nil] is used to remove the selected objects (employees)
>
> However in my app it didn't remove anything (the code was called, though).  After some searching, I ended up doing the following:
>
>        for (Employee *employee in employeeArrayController.selectedObjects)
>        {
>            [[self managedObjectContext] deleteObject: employee];
>        }
>
>
> It seems to work, but just to be sure I am checking here to see if this is indeed the correct approach?

It's *a* correct approach.

It's not clear what went wrong with '[employeeController remove: nil]', but that's a completely separate problem. For example, if you left the array controller in Class mode rather than Entity mode, 'remove:' won't update Core Data properly. Also, take a look at the class reference documentation for NSArrayController (for the 'removeObject:' method) for a discussion of how to configure the array controller's deletion behavior for Core Data.


_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

  • Follow-Ups:
    • Re: activating Delete menu item through binding
      • From: Koen van der Drift <email@hidden>
References: 
 >activating Delete menu item through binding (From: Koen van der Drift <email@hidden>)
 >Re: activating Delete menu item through binding (From: Quincey Morris <email@hidden>)
 >Re: activating Delete menu item through binding (From: Koen van der Drift <email@hidden>)
 >Re: activating Delete menu item through binding (From: Quincey Morris <email@hidden>)
 >Re: activating Delete menu item through binding (From: Koen van der Drift <email@hidden>)
 >Re: activating Delete menu item through binding (From: Quincey Morris <email@hidden>)
 >Re: activating Delete menu item through binding (From: Koen van der Drift <email@hidden>)

  • Prev by Date: Re: activating Delete menu item through binding
  • Next by Date: Re: Guidelines on using NSJSONSerialization
  • Previous by thread: Re: activating Delete menu item through binding
  • Next by thread: Re: activating Delete menu item through binding
  • Index(es):
    • Date
    • Thread