How to change the NSTimeInterval of an NSTimer after X seconds?

后端 未结 2 812
我寻月下人不归
我寻月下人不归 2021-01-26 15:12

I\'m making an app in swift 2 where there is two timers. After 10 seconds I would like another timer to go faster. I have tried doing it like this but it didn\'t work (I\'m tryi

2条回答
  •  孤街浪徒
    2021-01-26 15:54

    Just setting time = 1 will not modify timer.

    The timeInterval of a timer can not be changed. Your only options are to create a new timer or start it with a timeInterval of 1 and just do nothing every other time timer() is called until the 10 sec have passed.

提交回复
热议问题