How do I override layout of NSTableHeaderView?

前端 未结 4 1810
说谎
说谎 2021-01-06 06:30

I am trying to produce a custom header for my NSTableView. I would like to change the font of the header text and remove the borders and vertical separators.

My curr

4条回答
  •  独厮守ぢ
    2021-01-06 07:04

    One way to do it, in your NSTableViewDelegate's viewForTableColumn -function:

    if tableColumn!.identifier == "description" {
        let cell = NSTableHeaderCell()
        cell.title = "New Title"
        cell.backgroundColor = NSColor.redColor()
        cell.drawsBackground = true
        cell.bordered = false
        cell.font = NSFont(name: "Helvetica", size: 16)
        tableColumn!.headerCell = cell
    }
    

提交回复
热议问题