ios - NSTimer scheduledTimerWithTimeInterval返回(null)
PHPz
PHPz 2017-04-17 13:06:17
0
3
983


如图,为什么获取到的timer居然是null,导致之后没法进行暂停等操作了。谢谢!

PHPz
PHPz

学习是最好的投资!

reply all(3)
阿神

Later, I researched it clearly, and it was actually just the reason for the xcode display. You can already see by expanding (null) that _timer is already an object of NSCFTimer. (null) and nil here are completely different things.

阿神
[_timer invalidate];
_timer = nil;

Note that you have cleared _timer

小葫芦

Generally speaking, for the selector parameter, the method passed in should take an NSTimer type parameter, that is, the subject's animateOneFrame method should take this parameter, so the passed in should be @selector(animateOneFrame:).

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template