I’m creating a view-based table view and I’m having some trouble creating a custom group row. I want to have text in my group row and the default behavior Apple provides is great, but I need to change the color and appearance of the actual row. I have subclassed NSTableRowView and it works, but unfortunately not very well. Specifically when it starts to float I haven’t figured out how to change the alpha of the view without making the text alpha change too.
I’m creating a view-based table view and I’m having some trouble creating a custom
Share
It’s actually pretty easy. Make a new subclass of NSTableRowView and override the method drawRect:.
It’s best to always call [super drawRect:dirtyRect]; at the beginning.
Then you have the property self.isGroupRow. If it is, then just draw your custom group row.
You can load in the custom Row in the Table View delegate with the method tableView:rowViewForRow:.
Just return an instance of it right there