计时器:(目标动作)
定义枚举类型
typedef enum : NSUInteger {//enum枚举 integer整型 typedef定义类型 TimerTypeOnce, TimerTypeCircle, } TimerType;
声明方法:+设置目标动作回调
-(void)startWithType:(TimerType)type Duriation:(double)t; -(void)stop; -(void)addTarget:(id)target Action:(SEL)action;
计时器(delegate)
定义枚举类型+声明协议 protocol
typedef enum : NSUInteger { TimerTypeOnce, TimerTypeCircle, } TimerType; @protocol TimerDelegate;
引用协议+声明方法+实现协议
@property(nonatomic,weak)id<TimerDelegate>delegate; -(void)startWithType:(TimerType)type Duriation:(double)t; -(void)stop; @end @protocol TimerDelegate <NSObject> -(void)timerDidEnd:(TimerD *)t;
计时器(Block)
定义枚举类型+定义Block回调void(^类名)(回调类型)
typedef enum : NSUInteger { TimerTypeOnce, TimerTypeCircle, } TimerType;
typedef void(^TB)(void)
定义类名(strong)方法名????
定义方法