Re: Outline View not retaining objects it uses. Why?
Re: Outline View not retaining objects it uses. Why?
- Subject: Re: Outline View not retaining objects it uses. Why?
- From: Paul Sargent <email@hidden>
- Date: Sun, 20 Jul 2008 10:25:44 +0100
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 (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