selector
起動オブジェクトにセットされているセレクタを返します
解説
起動オブジェクトにセットされているセレクタを返します。
引数
フレームワーク
Foundation
クラス
NSInvocation
Instance Methods
使用可能
10.0
iOS2.0
例文
#import "MyObject.h" @implementation MyObject NSTimer *timer=nil; - (IBAction)myAction:(id)sender { NSMethodSignature *aSignature ; //起動オブジェクト NSInvocation *invocation ; //セレクタをセット SEL aSelector = @selector( timerControl ); //セレクタのメソッドシグネチャをセット aSignature = [ self methodSignatureForSelector:aSelector ]; //起動オブジェクトを作る invocation = [ NSInvocation invocationWithMethodSignature:aSignature ]; //ターゲットはself [ invocation setTarget: self ]; //セレクタをセット [ invocation setSelector: aSelector ]; //[ invocation invoke ];//起動する NSLog(NSStringFromSelector([invocation selector])); timer = [NSTimer scheduledTimerWithTimeInterval:1 invocation:invocation repeats:YES]; } -(void) timerControl{ NSLog(@"..."); } @end