cocoa - Create dynamic columns on NSTableView on reload -
i'm creating nstableview , have problem change tablecolumns. header appear black on terminate reload of data.
for (int = 0; < sqlite3_column_count(stmp); i++) { nstablecolumn *tablecolumn = [nstablecolumn new]; nsstring *columnname = [nsstring stringwithutf8string:sqlite3_column_name(stmp, i)]; [tablecolumn setidentifier:columnname]; nscell *cell = [[nscell alloc] inittextcell:columnname]; [cell setfont:[nsfont boldsystemfontofsize:[nsfont smallsystemfontsize]]]; [tablecolumn setheadercell:cell]; [tableview addtablecolumn:tablecolumn]; }
how reloading header without lost style?
edit 1
for (int = 0; < sqlite3_column_count(stmp); i++) { nstablecolumn *tablecolumn = [nstablecolumn new]; nsstring *columnname = [nsstring stringwithutf8string:sqlite3_column_name(stmp, i)]; [tablecolumn setidentifier:columnname]; nstextfieldcell *cell = [[nstextfieldcell alloc] inittextcell:columnname]; [cell settextcolor:[nscolor whitecolor]]; [tablecolumn setheadercell:cell]; [self.tableview addtablecolumn:tablecolumn]; }
this code appear name of columns in header not same initial style of header in nstableview
.
i'm copy header style temporary variable on initialize xib
... [self copycolumnconfiguration:columntemplate fromcolumn:self.tableview.tablecolumns[0]]; ... - (void)copycolumnconfiguration:(nstablecolumn*)dstcolumn fromcolumn: (nstablecolumn*)srccolumn { id srccell; id dstcell; srccell = [srccolumn datacell]; dstcell = [dstcolumn datacell]; [dstcell setalignment:[srccell alignment]]; [dstcell setformatter:[srccell formatter]]; srccell = [srccolumn headercell]; dstcell = [dstcolumn headercell]; [dstcell setalignment:[srccell alignment]]; }
and after create column copy new column style stored. more information see http://lists.apple.com/archives/cocoa-dev/2005/nov/msg00949.html
Comments
Post a Comment