I have NSTableView as a very central part of my application and want it to integrate with the rest of it. It has only one column (this is a list), and I draw all the cells myself (regular NSTextFieldCells).
The first problem is isolation. I draw the selection myself and want to get rid of the blue background. Now I fill the entire cell with the original background color to hide the blue background, but this does not look good when dragging the cell. I tried to override highlight:withFrame:inView:and highlightColorWithFrame:inView:NSCell, but nothing happened. How to disable automatic selection?
I also want all rows / cells to be undone when I click somewhere outside my NSTableView. Since the background / selection of the selected cell becomes gray, there must be an event for this, but I can not find it. I allow my cells to expand with a double click and may need to undo this. Therefore, getting rid of gray discharge is not enough.
EDIT: I add subview to NSTableView when the cell gets a double click and then resignFirstResponderNSTableView is called. I tried this:
- (BOOL)resignFirstResponder
{
if (![[self subviews] containsObject:[[self window] firstResponder]])
{
[self deselectAll:self];
...
}
return YES;
}
In addition, it does not work, I will need to implement this method for all objects in the view hierarchy. Is there any other solution to find out when the first responder leaves a certain hierarchy of views?