由 NSTimer 重复递增的静态计数器
每隔 1/16 秒,我就会触发一个 NSTimer,每次都会调用一个方法。 我想创建一个静态整数,每次调用该方法时都会增加“1”,一旦静态整数等于“16”,我希望调用另一个方法并将静态整数重置为“0”。
任何见解都将受到高度赞赏。 (语言是Obj-C)
Every 1/16 of a second, I have an NSTimer that fires, calling a method each time. I want to create a static integer that is increased by '1' each time the method is called, once the static integer is equal to '16', I wish to call another method and reset the static integer to '0'.
Any insight is greatly appreciated. (Language is Obj-C)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
所以将其声明为静态 int...
So declare it as a static int...