Question

I don't know how it happened, but all of a sudden in my table view I can't make an empty selection anymore. Like a table view row always has to be selected, and it can't be deselected by clicking somewhere else in the table view. I can select a different row, but I can't make an empty selection.

In the Interface Builder attributes for the table view empty selection is enabled, so I don't know where to look next. The one major change I made was that I installed OS X Snow Leopard. I'm not sure if this issue has something to do with that.

Thanks

Was it helpful?

Solution 4

I'm not allowed to say much more than this: It seems to be a problem with 10.6 specifically

OTHER TIPS

I struck this exact same issue (I am using XCode 4.2 but compiling against the 10.6sdk). NSOutlineView::deselectAll just was not deselecting things. I have a fairly complex NSOutlineView which exhibits the same behavior. I had a look on the apple developer forums and other places to try and work around this issue. However in the end working around this for me was very simple and I could just use:

- (void) myDeselectAll
{
   [self selectRowIndexes:[NSIndexSet indexSet] byExtendingSelection:NO];
}

Try doing it programmatically with the setter method setAllowsEmptySelection:. Alternatively, try disabling empty selection in IB, saving, then enabling it, saving one more time. That might fix it.

Also make sure that something in tableView:shouldSelectRow: isn't stopping you from it (provided you've implemented this delegate method).

Do you have your columns bound to an array controller? If so, check the controller's attributes.

This is a bit old, but for those who need an answer to this: Use the interface builder and mark the array controller. remove checkmark "avoid empty selection". If not done so, create an outlet for the array controller. Here I have called it DocumentArrayController.

then to empty selection:

 [_DocumentArrayController removeSelectionIndexes:
      [_DocumentArrayController selectionIndexes]]; 
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top