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.

It is not the case that the data source is only queried when you tell the outline view that the data has changed. An outline view may ask for objects any time it needs to know something about them. For example, if you scroll the view so that some rows are not visible, and then scroll back, the outline view may query the data source for the newly-revealed rows so that it can draw them. It does not necessarily remember the items just because they were previously visible.

To quote the docs <http://developer.apple.com/documentation/Cocoa/Conceptual/OutlineView/Articles/UsingOutlineDataSource.html#//apple_ref/doc/uid/20000725-140686 >:

"Just like a table view, an outline view uses the data source solely to get information. An outline view does not own its data source (see Communicating With Objects). Similarly, it does not own the objects it gets from the data source—if they are released your application is likely to crash unless you tell the outline view to reload its data. […] The data source is […] responsible for retaining all of the objects it provides to an outline view, and updating the outline view when there’s a change to the model. It is therefore not safe to release the root item—or any children—until you’re no longer displaying it in the outline view."

Cheers,
Ken_______________________________________________

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