ADCサンプル BoundButton
先月公開されたサンプルの Bound Button をちょっと見てみる。名前からだとわかりにくいけれど、Cocoa Bindings でアクションまわりのバインディングについてのサンプル。
このサンプルアプリケーションは
- ピザかカルゾーネのどちらにするかを選ぶ
- トッピングを選ぶ(複数選択可)
- Place your order ボタンを押すと、選択内容と金額が表示される
という動作をする。
ここでの特徴はボタンのバインディング Action Invocation を使っていること。その設定内容を見てみると、次のようになっている。
- target: OrderController.self
- argument: Entrees.selection
- argument2: Toppings.selectedObjects
- Selector Name: "orderEntree:withToppings:"
一般的なボタンのアクションでは -(IBAction)doAction:(id)sender という形式のアクションメソッドを呼び出すけれど、ここでは
25 @interface OrderController : NSObject
26 +-- 6 lines: {