NSTableview with different cells in one column

Discussion in 'Mac Programming' started by Boghog, Mar 7, 2010.

  1. Boghog macrumors member

    May 7, 2007
    I'm trying to find a way to display different kinds of NSCell subclasses (like Text Field, Check Box, etc.) for different rows but in the same column of an NSTableView.
    I've been trying to find an answer on the web, but maybe I'm not using the right search queries because I keep drawing blanks.

    In case you're interested, what I'm hoping to achieve is a way to allow a user to add something like properties (of different kinds) to an object at runtime, which would then be displayed in a list so that he can edit the values for these properties.

    Any help would be appreciated
  2. Sydde macrumors 68020


    Aug 17, 2009
    Do you think maybe the delegate method -tableView:willDisplayCell:forTableColumn:row: could work for you? The alternative would be to define the column's cell as a schizophrenic subclass of NSCell that you would code to decide what kind of cell it is based on what it gets from the datasource.
  3. BadWolf13 macrumors 6502

    Dec 17, 2009
    I'm sorry, but I gotta ask. Is "schizophrenic sublass" a real term in the programming world?
  4. Sydde macrumors 68020


    Aug 17, 2009
    Not as far as I know, but "class cluster" and "abstract class" did not really quite fit.

Share This Page