#pragma mark- Update by Timer Trigger
//對外接口
-(void) switchTransferDataTimerStatus:(BOOL)doYouWannaTurnOnTimer{
if (doYouWannaTurnOnTimer) {
[self _startTransferTimer];
}else{
[self _stopTransferTimer];
}
}
//開始timer
-(void)_startTransferTimer
{
if( !_transferTimer )
{
[self performSelector:@selector(_transferSportData) withObject:nil afterDelay:0.8f];
_transferTimer = [NSTimer scheduledTimerWithTimeInterval:TranferToWatchCycleInterval
target:self
selector:@selector(_transferSportData)
userInfo:nil
repeats:YES];
}
}
//關掉timer
-(void)_stopTransferTimer
{
if( _transferTimer )
{
[_transferTimer invalidate];
_transferTimer = nil;
}
}
//你要用timer做的事
-(void)_transferSportData{
NSLog(@"我被印出來啦");
}
沒有留言:
張貼留言