NSOperatio
1 @interface Operation : NSOperation { 2 } 3 @end 4 @implementa tion Operation 5 - (void) 6 Sub { 7 NSLog( @"Sub:%@", [ NSThread currentThr ead ] ); 8 // UIKit を使う処理 9 } 10 11 - (void) 12 main { 13 NSLog( @"main:%@", [ NSThread currentThr ead ] ); 14 [ self performSel ectorOnMai nThread:@selector(Sub) withObject :nil waitUntilD one:NO ]; 15 } 16 @end 17 18 19 { 20 NSOperatio nQueue* w = [ [ [ NSOperatio nQueue alloc ] init ] autoreleas e ]; 21 [ w addOperati on:[ [ Operation alloc ] init ] ]; 22 }
posted by
Saturn
on Tue 16 Nov 2010
at 02:29
