Re: Letting an instance know its own index within a container array - how to?
Re: Letting an instance know its own index within a container array - how to?
- Subject: Re: Letting an instance know its own index within a container array - how to?
- From: Keary Suska <email@hidden>
- Date: Tue, 07 Jan 2014 10:08:15 -0700
On Jan 7, 2014, at 9:09 AM, Peter wrote:
> Rethinking the problem of how to display row numbers in a view based NSTableView from a different perspective:
>
> I could use bindings if I could manage to make my row entities know their index within the table view content array.
>
> As a solution I could device a delegate for my entities and make the entity order the delegate to send a query to the array controller about its own index in arranged objects.
>
> Does this seem like a sane approach?
Honestly, not really. It does not sound like the number is a function of the model object. A better approach might be to either implement the -tableView:willDisplayCell:forTableColumn:row: or switch to using data source methods and implement –tableView:objectValueForTableColumn:row:. In either case you allow the table view to determine the line number, which seems more sensible to me.
HTH,
Keary Suska
Esoteritech, Inc.
"Demystifying technology for your home or business"
_______________________________________________
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