Re: Table view data source methods order?
Re: Table view data source methods order?
- Subject: Re: Table view data source methods order?
- From: Chase Meadors <email@hidden>
- Date: Mon, 3 Aug 2009 14:00:14 -0500
From: Chase Meadors <email@hidden>
Date: August 3, 2009 1:27:26 PM CDT
To: Andy Lee <email@hidden>
Subject: Re: Table view data source methods order?
This is beginning to frustrate me. I tried assigning the menu in the
-dataCellFor... method and eliminating -willDisplay... altogether.
But STILL all of my popups have index 0 selected. I'm returning a
correct and valid NSNumber representing the index I want to select
in the objectValue method.
On Aug 3, 2009, at 12:38 PM, Andy Lee wrote:
On Aug 3, 2009, at 1:04 AM, Chase Meadors wrote:
I'm having a bit of trouble here with table view data source
methods. I have implemented. I have these three:
1) - (NSCell *)tableView:(NSTableView *)sender
dataCellForTableColumn:(NSTableColumn *)tableColumn row:
(NSInteger)row;
2) - (id)tableView:(NSTableView *)sender objectValueForTableColumn:
(NSTableColumn *)tableColumn row:(NSInteger)row;
3) - (void)tableView:(NSTableView *)sender willDisplayCell:
(id)cell forTableColumn:(NSTableColumn *)tableColumn row:
(NSInteger)rowIndex;
I'm having trouble implementing what I want to implement. One
column in my table view has some popup cells that have unique
items to select from. In method 1) I'm returning a generic
NSPopUpButtonCell if appropriate.
In method 2), I return an index based on a string in the list of
values for that row.
In method 3), if the cell is one of my popups, I set it's menu to
the list of values for that row.
Here's the problem. I'm returning the correct index for an object
value in 2), but all of my popups have index 0 selected (with the
correct list). The only reason I can think of is that cocoa
follows this order:
1) call -objectValueFor...
2) THEN set the object value while the cell doesn't have it's list,
3) THEN call willDisplayCell...
Is there some way to implement this? They could simplify things by
just giving direct access to the cell in the objectValueFor...
method.'
If you put NSLogs at the beginning of each of the three methods,
what order are they called in?
Is there any reason not to assign the menu in method 1)?
--Andy
_______________________________________________
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