performSelectorOnMainThread:withObject:waitUntilDone:
メインスレッドのセレクタを実行します。
-(void)performSelectorOnMainThread:(SEL)aSelector: withObject:(id)arg: waitUntilDone:(BOOL)wait:
解説
メインスレッドのセレクタを実行します。
返り値
( void )
なし
フレームワーク
Foundation
クラス
NSObject
Class Methods
使用可能
10.2
参照
- performSelector:withObject:afterDelay:
- performSelector:withObject:afterDelay:inModes:
- performSelectorOnMainThread:withObject:waitUntilDone:modes:
例文
#import "MyObject.h" @implementation MyObject - (IBAction)myAction:(id)sender { [myOutlet setTitle:@"wait 3 second"]; [self performSelectorOnMainThread:@selector(sel:) withObject:@"active" waitUntilDone:YES ]; } - (void)sel:(NSString *)msg { [myOutlet setTitle:msg]; } @end