NSTimer timerWithTimeInterval: not working

后端 未结 4 1516
挽巷
挽巷 2020-11-28 13:21

I\'ve created a test application with timer before implementing it in my project. It was the first time I\'m using timer. But the issue is when I implemented timer using

4条回答
  •  孤街浪徒
    2020-11-28 13:52

    The difference between the two is that the timerWithTimeInterval method returns a NSTimer object that has not yet been fired. To fire the timer you have to use [timer fire]; On the other hand the scheduledTimerWithTimeInterval returns an NSTimer that has already been fired.

    So, in your first implementation you were just missing [timer fire];

提交回复
热议问题