iOS 定时器分辨率为 1 毫秒
在我的应用程序中,我有一个需要在屏幕上移动的对象(汽车图像)。 如果可能的话,我需要每 1 毫秒安排一次 myFunction。 我阅读了苹果文档,了解到 NSTimer 分辨率限制为 50-100 毫秒,这对于我的用例(在屏幕上快速移动对象)来说是不够的。
NSTimer 对象的替代品是什么?
提前致谢。
In my app I have an object(Car image) that needs to move on the screen.
I need to schedule myFunction every 1ms if possible.
I read apple documentation and I understood that NSTimer resolution is limited to 50-100ms, which is not enough for my use case (moving an object quickly on the screen).
What could be the alternatives to the NSTimer object?
Thanks in advance.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我认为你可能试图以太快的速度展示事物。屏幕刷新速度不那么快,因此以该频率触发计时器不会有帮助。
对于时序图形,请查看 CADisplayLink< /a> 当屏幕需要刷新时调用选择器的类。即基于显示刷新率的计时器。
I think you may be trying to show things at too fine a time rate. The screen doesn't refresh that fast, so having a timer fire with that frequency isn't going to help.
For timing graphics have a look at the CADisplayLink class which calls a selector when the screen needs to be refreshed. i.e. A timer that is based on the display refresh rate.