On 20 Jul 2008, at 09:02, Ken Thomases wrote:

On Jul 19, 2008, at 7:52 PM, Paul Sargent wrote:

While you're right I would return different objects if I was called twice, I'm not. As I understand it the Outline View will only ask for objects when it knows the data has changed (e.g. after a reloadData or reloadItem call) at which point it needs to expect a different object.

This is incorrect. An outline view is not expected to keep or manage the objects your data source returns to it. Your data source _is_ the cache of objects which the outlive view uses for that purpose. If the outline view were to implement its own cache, that would just be redundant.

Ok thanks, I see what I need to do and how to design things in the future.

I wasn't really expecting the view to keep a cache at all. I was expecting it to request the item each time it wanted information about it (in which case an returning an autoreleased object seemed reasonable). The fact that the object had a longer life caught me out. The documentation does say "outlineView:child:ofItem: is called very frequently". Granted that does suggest I don't want to be creating an object every time.

I didn't hit either of the notes about it just because of the way a tend to traverse the documentation. The way the documentation is worded it does seem like it's an exception to the normal Cocoa memory management.

Paul
_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]

Reply via email to