TimerBlock

来源:互联网 发布:java 运行jar 依赖包 编辑:程序博客网 时间:2024/06/08 06:21

typedefvoid(^TimerBlock)(void);



+ (NSTimer *)timerWithEvent:(TimerBlock)event TimeInterval:(NSTimeInterval)ti repeats:(BOOL)yesOrNo

{

    return [NSTimerscheduledTimerWithTimeInterval:ti target:selfselector:@selector(startTimer:)userInfo:event repeats:yesOrNo];

}


+ (void)startTimer:(NSTimer *)timer

{

   TimerBlock block = timer.userInfo;

    

   if (block) {

        block();

    }


}

0 0
原创粉丝点击