iOSInterviewQuestions
iOSInterviewQuestions copied to clipboard
第30题,使用dispatch source替换NSTimer
可以不使用nstimer或者cadisplaylink这些需要加入runloop的定时器,使用GCD dispatch source timer替换。而且这个NSRunLoopCommonModes 是合集,也不用先加入default吧,只加入NSRunLoopCommonModes就行。
直接添加到NSRunLoopCommonModes里不行吗?先加到NSDefaultRunLoopMode再加到NSRunLoopCommonModes,相当于有两个timer在同时调用了