最終更新:2013-01-10 (木) 04:30:36 (4122d)
ターゲット-アクション
Top / ターゲット-アクション
メッセージを通知するデザインパターン
接続
- Xcode/Assistant Editorでアクションを接続する
仕組み
- selector : 実際に呼び出されるメソッドのセレクタ
- target : メッセージを受け取るオブジェクト
書き方
AppKit
- AppKitの場合はこの形式
- (IBAction)action:(id)sender;
UIKit
- AppKitとは違い、形式が3種類ある。
- (IBAction)action: - (IBAction)action:(id)sender; - (IBAction)action:(id)sender forEvent:(UIEvent *)event
使われるコントロール
NSControl
- NSBrowser?
- NSButton
- NSPopupButton?
- NSColorWell?
- NSImageView?
- NSMatrix?
- NSForm?
- NSScroller?
- NSSegmentedControl?
- NSSlider?
- NSTableView
- NSStepper?
- NSTextField
UIControl
- UIButton
- UIDatePicker?
- UIPageControl
- UISegmentedControl
- UITextField
- UISlider?
- UISwitch
参考
関連
- Cocoa/デリゲート
- IBAction
- NSCell?
- NSActionCell
- UIEvent