GiGaMaskTime/GIGA/Category/NSTimer+Convenience.h

51 lines
1.2 KiB
Objective-C
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

//
// NSTimer+Convenience.h
// ISCTest
//
// Created by imac on 16/3/23.
// Copyright © 2016年 xiang. All rights reserved.
//
#import <Foundation/Foundation.h>
@interface NSTimer (Convenience)
typedef void (^LXVoidBlock)(void);
/**
* 创建Timer---Block版本
*
* @param interval 每隔interval秒就回调一次callback
* @param repeats 是否重复
* @param callback 回调block
*
* @return NSTimer对象
*/
+ (NSTimer *)scheduledTimerWithTimeInterval:(NSTimeInterval)interval
repeats:(BOOL)repeats
callback:(LXVoidBlock)callback;
/**
* 创建Timer---Block版本
*
* @param interval 每隔interval秒就回调一次callback
* @param count 回调多少次后自动暂停如果count <= 0则表示无限次否则表示具体的次数
* @param callback 回调block
*
* @return NSTimer对象
*/
+ (NSTimer *)scheduledTimerWithTimeInterval:(NSTimeInterval)interval
count:(NSInteger)count
callback:(LXVoidBlock)callback;
/**
* 开始启动定时器
*/
- (void)fireTimer;
/**
* 暂停定时器
*/
- (void)unfireTimer;
@end