• 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
Fwd: Table view data source methods order?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Fwd: Table view data source methods order?


  • Subject: Fwd: Table view data source methods order?
  • From: Chase Meadors <email@hidden>
  • Date: Mon, 3 Aug 2009 14:02:24 -0500




From: Chase Meadors <email@hidden>
Date: August 3, 2009 2:01:57 PM CDT
To: Quincey Morris <email@hidden>
Subject: Re: Table view data source methods order?

Actually, and I forgot to mention this, I need number 1 because my second column contains a mix of text cells and popup cells depending on the data type.

And see my message I just forwarded to the list (I keep forgetting to change the address to cocoa-dev when replying to people).

On Aug 3, 2009, at 1:27 PM, Quincey Morris 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 think you're making a mistake in expecting an order to be guaranteed amongst mixed data source and delegate methods. Whatever order you see now isn't guaranteed and could change in the future.


Your #2 is correctly implemented, so forget about it from the point of view of the delegate methods.

Since you only have one NSPopUpButtonCell, you don't need both #1 and #3. And since you apparently do need #1, you can get rid of #3, as Andy suggested.

Wherever you decide to set the menu for the current row, *that* method should also set the selected item index in the menu. Then it doesn't matter whether #2 is called before or after or at all. There's no reason for the delegate method to rely on the data source method to do its work for it.

You're not worrying about whether it's inefficient to recompute the selected menu item index, are you? If so, you can be sure a posse is going to be after you for "premature optimization". :)


_______________________________________________

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:
@gmail.com


This email sent to email@hidden


_______________________________________________

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


  • Prev by Date: Re: Table view data source methods order?
  • Next by Date: Re: addSubview: and positioning at the bottom of a NSWindow
  • Previous by thread: Re: Table view data source methods order?
  • Next by thread: Design Paterns: +/- Initializers and Subclassing
  • Index(es):
    • Date
    • Thread