5/12/2009

NSThread, NSTimer

I need a good way to display these battle messages with little delay like 1 second. NSThread and NSTimer were my options. It seems to be working.
NSThreadとか見てみるけど、「◯◯の攻撃!」「◯○のダメージ!」というふうに1秒の間を作ってみる。NSTimerでやってみた。うまくいきそう。


NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
[NSThread sleepForTimeInterval:0.3];
// do stuff here
[self performSelectorOnMainThread:@selector(addToBattleTextView:) withObject:aString waitUntilDone:NO];
[pool release];

No comments:

Post a Comment