0
私は、NSThreadを使って別のスレッドにオブジェクトを作成します。NSNotificationとNSThread
NSThread* myThread = [[[NSThread alloc] initWithTarget:self selector:@selector(createNewObject:) object:elements] autorelease];
[myThread start]; // Actually start the thread
このオブジェクトはイベントを待機します。このイベントが発生すると、デフォルトの通知センターに通知が送信されます。
私のAppControllerは通知を受け取り、セレクタを実行します。
NSNotificationCenter *nc = [NSNotificationCenter defaultCenter];
[nc addObserver:self selector:@selector(myMethod:) name:MyNotification object:nil];
質問:が行う方法(MyMethodは:)メインスレッド上又は上記(myThread)からスレッド上のセレクタランから?
Thx !!! (「イベント待ち」と言うと、ユーザーのやりとりに反応することを意味していましたが、わかりません) – Daniel
ところで:特定のメソッドを実行するスレッドの名前を調べる方法はありますか? – Daniel
@Daniel:スレッドには名前がありません。メインスレッドを除いて、それはです。 –