• 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: Letting an instance know its own index within a container array - how to?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


References: 
 >Letting an instance know its own index within a container array - how to? (From: Peter <email@hidden>)

  • Prev by Date: Letting an instance know its own index within a container
  • Next by Date: Re: Set up an editable view based NSTableView programmatically - how to?
  • Previous by thread: Letting an instance know its own index within a container array - how to?
  • Next by thread: UINavigationBar.tintColor life on own?
  • Index(es):
    • Date
    • Thread