IOS6學習筆記(四)

1.GCD設置一個timer計時器spa

- (void)awakeFromNib {get

    __weak id weakSelf = self;event

    double delayInSeconds = 0.25;class

    _timerdispatch_source_create(DISPATCH_SOURCE_TYPE_TIMER, 0, 0,dispatch_get_main_queue());date

    dispatch_source_set_timer(_timer, dispatch_walltime(NULL, 0),(unsigned)(delayInSeconds * NSEC_PER_SEC), 0);queue

    dispatch_source_set_event_handler(_timer, ^{im

        [weakSelf updateValues];di

    });handler

    dispatch_resume(_timer);co

}

- (void)updateValues {

}

- (void)dealloc {

    dispatch_source_cancel(_timer);

}

相關文章
相關標籤/搜索