Re: table row numbers with NSArrayController
Re: table row numbers with NSArrayController
- Subject: Re: table row numbers with NSArrayController
- From: Daryn <email@hidden>
- Date: Fri, 26 Dec 2003 01:22:28 -0600
On Dec 24, 2003, at 1:43 PM, Scott Anguish wrote:
>
>
On Dec 24, 2003, at 1:59 PM, Daryn wrote:
>
>
> Is there a table binding that would allow the display of the row
>
> number?
>
>
>
>
there isn't a binding or option for that, no.
>
>
I can't think of a way to do that that wouldn't be pretty hacky,
>
aside from having the model object have a key that can return the
>
index of an object in the array.
I thought I'd be clever and bind the row number column to a controller
key of "rowNumbers" and do this:
@implementation NSArrayController (MyArrayControllerAdditions)
- (unsigned int)countOfRowNumbers { return [[self content] count]; }
- (id)objectInRowNumbersAtIndex:(unsigned int)index { return [NSString
stringWithFormat:@"%i",index]; }
@end
Unfortunately every cell gets the entire array of row numbers.
Naturally I'd like the array controller to treat rowNumbers like
arrangedObjects and use the row number as an index into the array. Is
the arrangedObjects property specially hardcoded into the array
controller, or is there a programatic way to set this "indexable
behavior" on a property?
(I know I can do row numbers easily with a datasource, but I'm just
having fun experimenting with controllers)
[demime 0.98b removed an attachment of type application/pkcs7-signature which had a name of smime.p7s]
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.