定時器

 

**定時器的 建立async

**  注意:本身新開線程的時候的 才能夠用 --  NSRunLoop     已經在主線程的 時候 不用runLoop  否則定時器的方法 不能改UI   oop

       dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{spa

            timer = [NSTimer scheduledTimerWithTimeInterval:KTimeInterval target:self selector:@selector(update:) userInfo:nil            repeats:YES];線程

            [[NSRunLoop currentRunLoop] addTimer:timer forMode:NSRunLoopCommonModes];get

            [[NSRunLoop currentRunLoop] run];it

        });date

 

**定時器的 移除select

    [timer invalidate];定時器

    timer  = nil;queue

相關文章
相關標籤/搜索