본문 바로가기
Objective-c

NSTimer

by GGoris 2014. 4. 25.
반응형

NSTimer *myTImer = [NSTimer timerWithTimeInterval:2.0 target:self                                  selector:@selector(MethodName) userInfo:nil repeats:YES];

NSRunLoop *runner = [NSRunLoop currentRunLoop];

[runner addTimer:reconnectTimer forMode: NSDefaultRunLoopMode];




or




[NSTimer scheduledTimerWithTimeInterval:2.0 target:self selector:@selector(MethodName) userInfo:nil repeats:YES];





* timeWithTimeInterval:target:selector:userInfo:repeats는 타이머를 생성만 함.

* scheduledTimerWithTimeInterval:target:selector:userInfo:repeats는 타이머 생성과 동시에 시작을 함.


반응형

댓글