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


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM