65 다 중 스 레 드 NSThread 사용

전송:http://www.cnblogs.com/wzh521/p/4823379.html
NSThread    :
         :  perform     ,      threadAction
 2    [self performSelectorInBackground:@selector(threadAction) withObject:@"thread"];
 3     
 4       :
 5     NSThread *thread = [[NSThread alloc] initWithTarget:self selector:@selector(threadAction:) object:@"text"];
 6      thread.name = @"thread1";
 7     //    
 8     [thread start];
 9     
10     //   :      ,    
11     [NSThread detachNewThreadSelector:@selector(threadAction:) toTarget:self withObject:@"thread2"];
 1 //      
 2 NSThread *thread = [NSThread currentThread];
 3 //          
 4 [NSThread isMultiThreaded]
 5 //          
 6 [NSThread isMainThread]
 7 //         
 8 [NSThread sleepForTimeInterval:3];
 9 //     
10 //    [self performSelectorOnMainThread: withObject: waitUntilDone:]

좋은 웹페이지 즐겨찾기