setEventHandler:andSelector:forEventClass:andEventID:
イベントハンドラを登録します
-(void)setEventHandler:(id)handler: andSelector:(SEL)sel: forEventClass:(AEEventClass)eventClass: andEventID:(AEEventID)eventID:
解説
イベントハンドラを登録します。
他のアプリケーションにイベントを送るためには使用することはできません。
AEEventClassやAEEventIDの定数はCarbonにあります
返り値
( void )
なし
引数
( id )handler
( SEL )sel
アクションセレクタ
( AEEventClass )eventClass
イベントクラス
( AEEventID )eventID
イベントID
フレームワーク
Foundation
クラス
NSAppleEventManager
Instance Methods
使用可能
10.0
参照
例文
#import "Controller.h" @implementation Controller - (IBAction)pushButton:(id)sender { NSAppleEventManager *aeMgr; aeMgr = [NSAppleEventManager sharedAppleEventManager]; [ aeMgr setEventHandler:self andSelector:@selector(handleAppleEvent:withReplyEvent:) forEventClass:kASAppleScriptSuite andEventID:kASCommentEvent ]; } - (void)handleAppleEvent:(NSAppleEventDescriptor *)inEvent withReplyEvent: (NSAppleEventDescriptor *)outReplyEvent { NSLog(@"!!!"); } @end