开发者

iPhone: Maintain Timer value between different views

开发者 https://www.devze.com 2023-03-13 00:01 出处:网络
I have built iPhone game application which has loads of views. The next view gets decided based on the user\'s current action. It working fine absolutely开发者_StackOverflow社区. I want to start a tim

I have built iPhone game application which has loads of views. The next view gets decided based on the user's current action. It working fine absolutely开发者_StackOverflow社区. I want to start a timer when my game gets started and want to keep incrementing till game finished. Nothing fency! The problem is I can put label on view and use NS Timer ticks to increment its value but how to synchronize that value when move to next view?

Could anyone please let me know if there is already framwork available that support this or any way to implement this.

Thanks.


The easiest solution would be to have the timer be a property in your app delegate, so you can access it from any view/view controller. That's what I'd do here. It doesn't seem to "belong" to individual views based on what you've described.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号