• 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: Implementing NSOutlineView autosaveExpandedItems with CoreData
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Implementing NSOutlineView autosaveExpandedItems with CoreData


  • Subject: Re: Implementing NSOutlineView autosaveExpandedItems with CoreData
  • From: Ron Lue-Sang <email@hidden>
  • Date: Tue, 1 Jul 2008 09:19:51 -0700


On Jul 1, 2008, at 12:05 AM, Andy Kim wrote:

Thanks - I've seen solutions like this before, I just wanted to get it working the regular way!

I totally understand the sentiment.

Is itemForPersistentObject expecting an NSTreeNode? You say you have it working in a similar way - what does your itemForPersistentObject method return?

Many thanks
Ian

Here's what I do:

- (id)outlineView:(NSOutlineView *)ov itemForPersistentObject: (id)object
{
return [[gAppDelegate library] groupWithUID:object]; // This fetches the group from the managed object context
}


- (id)outlineView:(NSOutlineView *)ov persistentObjectForItem:(id)item
{
	return [item uid];
}

According to the docs I'm supposed to archive the persistent object before returning it, but in my case, it doesn't matter because it's just a string and it all goes into a plist anyway. I have tried it both ways after seeing your implementation though, and there are indeed no differences.

I see why you're thinking that you need to return a NSTreeNode though. I don't need to do that because I don't use a NSTreeController and instead implement the data source protocol in my custom controller. So for me the item is the model object itself.

In your case, I'm fairly positive that you do need to return the NSTreeNode object. Instead of fetching the model object, walk the controller's content tree looking for the right representedObject with the UID.

- Andy Kim


Andy, you're right.
Ian's code needs to return an NSTreeNode. Please file a bug that this is too hard.




_______________________________________________

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


--------------------------
RONZILLA



_______________________________________________

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: Implementing NSOutlineView autosaveExpandedItems with CoreData
      • From: Ian <email@hidden>
References: 
 >Re: Implementing NSOutlineView autosaveExpandedItems with CoreData (From: Andy Kim <email@hidden>)

  • Prev by Date: Re: PDFDocument subclass with an undo manager
  • Next by Date: Re: NSDateComponents question
  • Previous by thread: Re: Implementing NSOutlineView autosaveExpandedItems with CoreData
  • Next by thread: Re: Implementing NSOutlineView autosaveExpandedItems with CoreData
  • Index(es):
    • Date
    • Thread