//用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://blog.csdn.net/samuelltk/article/details/7484533