//用nstimer的用法 一种用法,要手动加入到NsRunLoop中
NSTimer *time= [NSTimer timerWithTimeInterval:3 target:self selector:@selector(NoticeTransation) userInfo:nil repeats:YES];
[[NSRunLoop currentRunLoop] addTimer:time forMode:NSDefaultRunLoopMode];//手动加入到NSRunLoop中
[time fire];//立即触发定时器
//第二种方法
NSTimer *timer= [NSTimer scheduledTimerWithTimeInterval:3 target:self selector:@selector(NoticeTransation) userInfo:nil repeats:YES];
[timer fire]; |
|