Why is NSPopUpButtonCell showing correctly when only setObjectValue:nil is called?

An NSTableView has multiples NSCells (indirectly via NSTableColumn). NSCell follows the Flyweight design pattern; they're cookie-cutters. There's one cell per column and it's asked to draw itself for each row. "Here's a value, draw it on the first row; here's the value for the second row, etc." This is in contrast to view-based tableviews which have a view instance per cell.

I've subclassed NSPopUpButtonCell and for each setXxxValue: method, I call NSLog(); and forward the message to the super class. The only method which gets called (say, when adding new rows, or otherwise refreshing the table) is setObjectValue:. This is expected from the documentation... but null is the only thing passed to it!! It should be passed an NSNumber with the selected item index.

My table draws fine. I'm just trying to understand this because I want to extend/change the behaviour of the cell (obviously as I would'nt have needed a subclass otherwise).

<strong>Question:</strong> How is this possible? How is the NSPopUpButtonCell being set to a value in order to draw the right value for each row. Even considering bindings, it's NSTableColumn doing the heavy lifting, no? What am I missing?


"Every row in a table shares the same popup menu" – that doesn't need to be the case.

In addition to setting the table column's value binding, set the cell's content binding to an array property of your model object, via your array controller.

You can keep the code which determines the options in the model (just create an array of strings). That way you won't need a custom subclass.


  • How to set the variables of LSTMCell as input instead of letting it create it in Tensorflow?
  • UIWebView: Disable copy/cut options for a rich text editor
  • Android Lint complaining about activity not registered in AndroidManifest, but it is
  • a simple person class in objective c
  • Why won't my UITableViewCell deselect and update its text?
  • CFNetwork SSLHandshake failed (-9806) & (-9800) & (-9830)
  • iOS - Changing frame of a subview of a subclassed UIView (using storyboard with auto layout enabled)
  • Blackberry 6: how to detect a long click on track pad?
  • Creating Java object from class name with constructor, which contains parameters [duplicate]
  • gspread or such: help me get cell coordinates (not value)
  • how to avoid repetitive constructor in children
  • How can I set a binding to a Combox in a UserControl?
  • Saving Changes After In-App Purchase Has Been Purchased
  • Retrieve list of sent friend requests from friend_request FQL table
  • QLPreviewController hide print button in ios6
  • SplFileObject error failed to open stream: No such file or directory
  • print() is showing quotation marks in results
  • Play WS (2.2.1): post/put large request
  • Refering to the class itself from within a class mehod in Objective C
  • Exception “firebase.functions() takes … no argument …” when specifying a region for a Cloud Function
  • NHibernate Validation Localization with S#arp Architecture
  • Highlight one bar in a series in highcharts?
  • All Classes Conforming to Protocol Inherit Default Implementation
  • How can I send an e-mail from a vbs script
  • Spring security and special characters
  • Deleting and Updating values from a cusrsor adapter
  • Accessing IRQ description array within a module and displaying action names
  • Possible to stop flickering java tooltip in heavyweight mode?
  • Trying to switch camera back to front but getting exception
  • Calling of Constructors in a Java
  • PHP: When would you need the self:: keyword?
  • Load html files in TinyMce
  • Free memory of cv::Mat loaded using FileStorage API
  • Angular 2 constructor injection vs direct access
  • Getting Messege Twice Using IMvxMessenger
  • Change div Background jquery
  • How does Linux kernel interrupt the application?
  • Programmatically clearing map cache
  • Busy indicator not showing up in wpf window [duplicate]
  • Why do underscore prefixed variables exist?