• 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
core data, selected items and undo
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

core data, selected items and undo


  • Subject: core data, selected items and undo
  • From: Brian Williams <email@hidden>
  • Date: Tue, 16 Jan 2007 10:19:36 -0800

Hello Cocoa Devers,

I have a bit of a core data design problem and I am hoping that I can get some suggestions from the list.

I am creating a drawing program (of sorts). This program has graphic elements like circles and squares etc that are represented by objects in the xcdatamodel. My app differs from the standard drawing program in that I have different views that show different sets of graphics, it's too complicated to get into here, but there are different views that are shown in a main view and to the side of the main view is a property inspector. When a graphic is selected it is placed into an array controller(selectedGraphicsArrayController). The property inspector is observing the selectedGraphicsArrayController arrangedObjects and displays the properties of the selected graphic elements just fine. The problem is with undo. If I create a new graphic, then select it so that the inspector is showing it's properties and then undo to before the graphic exists, the inspector is now inspecting, not a nil object, but a kind of zombie object. The object is not populated with any data, but is still in the system and still in the selectedGraphicsArrayController. My question is how can I programatically identify these objects, or better yet how can I get them automatically removed from the array? Two ideas I have looked into are:

1) Have a attribute called isValid in the object that defaults to NO, on awake set it to YES, when it's cleared out and zombied it should revert back to NO and I can use that to Id it. Then the inspector will know not to show values for it. One problem is that the selectedGraphicsArrayController still has zombies in it. I guess I could create a arrayController subclass that observes the isValid property and boots out any zombies.

2) Add an isSelected attribute to the model object that core data can track and update during undo. The selectedGraphicsArrayController could then be set directly get all the selected graphics from the model with a predicate. I think that this will change on undo/redo and the object will be removed from the array by core data before it's a zombie.

Thanks for any help.

Brian


_______________________________________________

Cocoa-dev mailing list (email@hidden)

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: core data, selected items and undo
      • From: Martin Wennerberg <email@hidden>
  • Prev by Date: RE: Debuging
  • Next by Date: Re: Debuging
  • Previous by thread: Best way to use NSView in more than one NSToolbar simultaneously?
  • Next by thread: Re: core data, selected items and undo
  • Index(es):
    • Date
    • Thread