Are there any methods to customize the header from view-based NSTableView? Or somehow change the color of the table title? Found very little information on this issue.
3 answers
I found so far only such a method, but draws on top of the text, so you have to reduce alpha. Maybe someone knows less curved method?
NSGradient *gradientToFill = [[NSGradient alloc] initWithStartingColor:[NSColor colorWithCalibratedRed:0.f green:0.f blue:0.35f alpha:0.1] endingColor:[NSColor colorWithCalibratedRed:0.5546875 green:0.59765625 blue:0.66015625 alpha:0.1]]; [gradientToFill drawInRect:dirtyRect angle:0]; |
Create your own subclass from NSTableHeaderView. Set the table the necessary header through the property
@property(strong) NSTableHeaderView *headerView - This is an NSTableView, this is not the same as UITableView. - Ilya Terezniki
- Corrected for mac - Maxim Bogdanov
|
The code that changes the header column in NSTableView:
NSString *title = @"Your Title"; NSTableColumn *yourColumn = self.tableView.tableColumns.lastObject; [yourColumn.headerCell setStringValue:title]; - This is an NSTableView, this is not the same as UITableView. - Ilya Terezniki
|