Re: table row numbers with NSArrayController
Re: table row numbers with NSArrayController
- Subject: Re: table row numbers with NSArrayController
- From: Scott Anguish <email@hidden>
- Date: Fri, 26 Dec 2003 02:27:41 -0500
one potential issue that mmalc raised is that you'd typically bind the
table items to the arranged objects, so you'd need to do this at the
controller level (as you have).
if you're trying to do what iTunes does in displaying the numbers
beside the tunes, I think the indexes would need to be kept in the data
model. that way even when they're rearranged they'll be correct.
On Dec 26, 2003, at 2:22 AM, Daryn wrote:
>
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.