osx - How to get NSTableView to use a custom cell view mixed with preset cell views? -


i have nstableview configured in interface builder uses several default cell views. first column's cell view needs created custom class. how implement nstableviewdatasource method tableview.viewfortablecolumn() creates default cell views remaining columns?

here's method far:

func tableview(tableview:nstableview, viewfortablecolumn tablecolumn:nstablecolumn?, row:int) -> nsview? {     /* create custom cell view first column. */     if (tablecolumn?.identifier == "namecolumn")     {         let view = tableview.makeviewwithidentifier("namecellview", owner: nil) as! nametablecellview;         return view;     }      /* return default cell views (defined in ib) rest. */     return tableview.viewatcolumn(??, row: row, makeifnecessary: true); // how column index?? } 

how right column index tableview.viewatcolumn()? tableview.columnforview() or tableview.columnwithidentifier() not option in case.

i'd try giving default cell own identifier in interface builder...

enter image description here

...then use in conjunction makeviewwithidentifier::

func tableview(tableview: nstableview,     viewfortablecolumn     tablecolumn: nstablecolumn?, row: int) -> nsview? {          var viewidentifier = "standardtablecellview"          if let column = tablecolumn {              switch column.identifier {              case "namecolumn":                 viewidentifier = "namecellview"              default: break              }         }          return tableview.makeviewwithidentifier(viewidentifier, owner: self) as? nsview } 

Comments

Popular posts from this blog

javascript - Google App Script ContentService downloadAsFile not working -

javascript - Function overwritting -

php - Find a regex to take part of Email -