我可以用CADisplayLink作为NSTimer吗?

时间:2022-05-09 20:34:00

I was wondering, can I use a CADisplayLink Timer instead of an NSTimer even though I'm not doing any animation?

我在想,我能不能用CADisplayLink定时器代替NSTimer,即使我不做动画?

I'd like to call a certain method much like when using an NSTimer, only just at a much higher frequency (60 Hz would be nice), so I was wondering if a CADisplayLink Timer would work even though the method simply does some calculations and not any animation...

我想调用一个特定的方法,就像使用NSTimer一样,只是在一个更高的频率上(60 Hz会更好),所以我想知道CADisplayLink计时器是否可以工作,即使这个方法只是做一些计算而不是任何动画……

P.S. I'm testing on an iPhone 4

附注:我在iPhone 4上测试。

1 个解决方案

#1


4  

I don't see why not. You may even receive better performance from CADisplayLink because it is not performing any animation. The only problem you might run into is how the Apple Review Board will like your use of it.

我不知道为什么。您甚至可能从CADisplayLink获得更好的性能,因为它没有执行任何动画。你可能遇到的唯一问题是,苹果审查委员会会喜欢你使用它。

I would suggest looking over the Class Reference along with the avTouch Sample Code provided before using it.

我建议在使用类引用之前,先查看一下提供的avTouch示例代码。

#1


4  

I don't see why not. You may even receive better performance from CADisplayLink because it is not performing any animation. The only problem you might run into is how the Apple Review Board will like your use of it.

我不知道为什么。您甚至可能从CADisplayLink获得更好的性能,因为它没有执行任何动画。你可能遇到的唯一问题是,苹果审查委员会会喜欢你使用它。

I would suggest looking over the Class Reference along with the avTouch Sample Code provided before using it.

我建议在使用类引用之前,先查看一下提供的avTouch示例代码。