osx - How to get custom table cell views into NSTableView? -
i have nstableview
uses standard nstexttablecellview
s want other cells contain ui component in table in 1 or 2 rows. question is: define custom cells cocoa finds them?
i dropped custom nstablecellview
xib (same xib in table is) , gave identifier. using code not find cell ...
func tableview(tableview:nstableview, viewfortablecolumn tablecolumn:nstablecolumn?, row:int) -> nsview? { var view:nstablecellview?; if (tablecolumn?.identifier == "labelcolumn") { view = tableview.makeviewwithidentifier("labelcell", owner: nil) as? nstablecellview; view!.textfield?.stringvalue = _formlabels[row]; } else if (tablecolumn?.identifier == "valuecolumn") { if (row == 1) { view = tableview.makeviewwithidentifier("customcell", owner: nil) as? nstablecellview; println("\(view)"); // nil - not found! } else { view = tableview.makeviewwithidentifier("valuecell", owner: nil) as? nstablecellview; view!.textfield?.stringvalue = _formvalues[row]; } } return view; }
all works cell id customcell
not found. how tell cocoa find it?
you need drop new cell view in table column contain kind of cell view (the 1 identifier "valuecolumn", in case).
Comments
Post a Comment