• 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: Custom NSCell and target/action
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Custom NSCell and target/action


  • Subject: Re: Custom NSCell and target/action
  • From: Vincent Habchi <email@hidden>
  • Date: Fri, 19 Nov 2010 16:09:07 +0100

Le 19 nov. 2010 à 15:39, Graham Cox a écrit :

> 1. Playing nice with the color panel requires a little care, because it's shared by not only any color wells in your app, but by any responders that implement -changeColor:

You're right, I'll try to be cautious.

> 2. A table column only has one cell, reused as needed to draw each row. So connecting the cell directly to the panel is a bad idea - all the colours in all rows will change at once.

I've learned that the hard way: the table column makes calls to copyWithZone: to get a transitory copy and all the stuff happens from that copy. Trying to interact directly with the cell is defeated: the self pointer is invalid. It is not even possible to set the cell as the target of the color panel action!

> 3. Use MVC. If a property of your data model is a colour, then your controller can set this from the color panel via -changeColor: on a first responder (tableview, most likely) and some logic you'll need to implement to establish which row is selected for colour input. Once the property is set, you refresh the table as usual and the cell will display the colour for the appropriate row.

I was figuring out a way to short-circuit this round trip, but you finished to convince me that it is unwise.

What method does the NSTableView use to inform the cell of its contents? -setObjectValue:?

Thanks a lot for your precious advice.
Vincent_______________________________________________

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

  • Follow-Ups:
    • Re: Custom NSCell and target/action
      • From: Corbin Dunn <email@hidden>
References: 
 >Custom NSCell and target/action (From: Vincent Habchi <email@hidden>)
 >Re: Custom NSCell and target/action (From: Graham Cox <email@hidden>)

  • Prev by Date: Re: Why UIBarButtonItemStyleBordered?
  • Next by Date: Re: [iPhone] Make UIWebView content empty before loading next page
  • Previous by thread: Re: Custom NSCell and target/action
  • Next by thread: Re: Custom NSCell and target/action
  • Index(es):
    • Date
    • Thread