黑马程序员技术交流社区
标题:
NSTimer
[打印本页]
作者:
602516169
时间:
2016-8-31 07:05
标题:
NSTimer
//用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];
欢迎光临 黑马程序员技术交流社区 (http://bbs.itheima.com/)
黑马程序员IT技术论坛 X3.2