So I am going for a custom looking NSTableView. I've already successfully subclassed NSTableRowView
and NSTextFieldCell
to achieve the look I'm going for, however I'm struggling of getting rid of the default styling for the header. I seem to be able to tweak its frame, however I'm not sure where the rest of the default styling is coming from.
As you see on the screenshot the red area is the increased frame of the headerView
. I'm using its CALayer
to set the colour, however how to change the contents inside is beyond me...
Here's what I'm doing in the viewDidLoad
of my ViewController
override func viewDidLoad() {
super.viewDidLoad()
tableView.delegate = self
tableView.dataSource = self
tableView.wantsLayer = true
tableView.headerView?.frame = NSMakeRect(0, 0, (tableView.headerView?.frame.width)!, 32.00)
tableView.headerView?.wantsLayer = true
tableView.headerView?.layer?.backgroundColor = NSColor.red.cgColor
}
I've also tried subclassing NSTableHeaderView
, however this class seems to be extremely limited in terms of the customizations I can make...
Any help would be appreciated?