NSThread (1) 리스트형 27. NSThread // 스레드는 한 함수를 관리한다. // 때문에 새로운 스레드가 실행되면서 함수를 실행하고, 함수가 끝나면 자연히 스레드가 종료된다. // 그래서 함수 내부에서 무한 루프를 돌면 스레드가 죽지않고 계속 유지됩니다. // 메인스레드의 이벤트루프가 이런 원리임. 이벤트루프에서 나와서 스레드가 끝난다는 것은 앱의 종료를 의미 // 생성 1 [NSThread detachNewThreadSelector:@selector(_th) toTarget:self withObject:nil]; // 생성 2 NSThread *thTime; thTime = [[NSThread alloc] initWithTarget:self selector:@selector(_th) object:nil]; [thTime start]; - (v.. 이전 1 다음