Table view double-click actions
It used to be that when you wanted to receive a double-click notification from an NSTableView, you had to do this in your -awakeFromNib
:
[tableView setTarget:self]; [tableView setDoubleAction:@selector(doMagicThings:)];
Now, with the power of Bindings, you can do this in IB!
- Create an NSObjectController. Set its class name to the class of the desired receiver, and its “content” outlet (not binding) to the desired receiver.
- Bind the table view's doubleClickTarget binding to the object controller. Controller key: content. Leave the model key path empty.
- Put the selector name in the field at the bottom of the binding view.
And a cheesy way that doesn't involve a controller:
- Add a method named
-self
to your receiver's class (or to NSObject) that simply returns self. - Bind the table view's doubleClickTarget binding directly to the receiver. Model key path: self.
- Put the selector name in the field at the bottom of the binding view.
0 comments:
Post a Comment
<< Home