NSTableview with different cells in one column

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

  1. Boghog macrumors member

    Joined:
    May 7, 2007
    #1
    Hi,
    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

    Sydde

    Joined:
    Aug 17, 2009
    #2
    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

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

    Sydde

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

Share This Page