title: NSArrayController: How to programmatically clear selection?
body: <p>Very simple question that's driving me crazy: What's the proper way to clear the selection of an NSArrayController programmatically?</p>
  
  <p>I'm designing a view with the following components:</p>
  
  <ul>
  <li>NSArrayController *controller1: Bound to an array of objects</li>
  <li>NSPopUpView view1: Content bound to controller1.arrangedObjects; Value bound to controller1.selection; "Inserts Null Placeholder" selected</li>
  <li>NSArrayController *controller2: Bound to an array stored in controller1.selection</li>
  <li>NSPopupView view2: Content bound to controller2.arrangedObjects; value bound to controller2.selection; "Inserts Null Placeholder" selected</li>
  </ul>
  
  <p>Initially, view1's content is populated; controller1 and controller2 have nil selection values; and view1 and view2 display null placeholders. Selection of controller1 causes controller1's selection to change and view2's content to populate. All good.</p>
  
  <p>I'd like to implement a Clear button that clears the selection of controller1, which, thanks to bindings, should also clear the selection of controller2 and reset view1 and view2 to the null placeholder. For the life of me, I can't figure out the proper code for this very simple function. Altering the selection of controller1 fails to update the value shown in view1. Worse, altering the controller1 selection programatically causes weird things to happen in controller2: further selection of values in view1 fails to have any effect on view2.</p>
  
  <p>Things I've tried:</p>
  
  <ul>
  <li><p>Calling the SetSelectedObjects method of controller1 with an [NSArray new].</p></li>
  <li><p>Calling the SetSelectedObjects method of controller1 with null.</p></li>
  <li><p>Calling the SetSelectedIndex method of controller1 with NSNotFound.</p></li>
  <li><p>Calling the RemoveSelectedIndex method of controller1 with the SelectedIndex property of controller1.</p></li>
  <li><p>Looking in the Cocoa NSArrayController documentation for any class method or suggestion for clearing the selection value. Nothing there - not even any mention of this being desirable, let alone how to accomplish it.</p></li>
  </ul>
  
  <p>Any ideas? Thanks...</p>