• 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: Line Numbers in Tables
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Line Numbers in Tables


  • Subject: Re: Line Numbers in Tables
  • From: "Daniel T. Staal" <email@hidden>
  • Date: Wed, 29 Aug 2007 12:23:04 -0400 (EDT)
  • Importance: Normal

On Wed, August 29, 2007 12:07 pm, Gordon Apple said:
> Simple function --  apparently no simple solution.  I just want to put
> line numbers in one column of a table.  I want them to start at "1" and
> stop at the last table entry.  Nothing I've tried works and I've searched
>  available resources.

Have you tried returning the row number in the
tableView:objectValueForTableColumn:row: datasource method?  I'd think
that should work...

Something along the lines of:

tableView:table objectValueForTableColumn:column row:row {
   if ([column identifier] == <number_column>) {// Obviously this is wrong.
      return [NSNumber numberWithInt:row];
   }
}

(You many want row+1, of course.)

This of course means you are using a datasource and not bindings/KVC, but
the difference isn't all that great...

Daniel T. Staal

---------------------------------------------------------------
This email copyright the author.  Unless otherwise noted, you
are expressly allowed to retransmit, quote, or otherwise use
the contents for non-commercial purposes.  This copyright will
expire 5 years after the author's death, or in 30 years,
whichever is longer, unless such a period is in excess of
local copyright law.
---------------------------------------------------------------

_______________________________________________

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: 
 >Line Numbers in Tables (From: Gordon Apple <email@hidden>)

  • Prev by Date: Re: Line Numbers in Tables
  • Next by Date: Re: Retrieve local currency format ?
  • Previous by thread: Re: Line Numbers in Tables
  • Next by thread: Re: Line Numbers in Tables
  • Index(es):
    • Date
    • Thread