开发者

I need to create a timer that has hour, mins, and seconds

I currently have code that can display mins and seconds. But the problem I'm facing is that when the mins gets to 60, it cou开发者_JAVA百科nts up to 61 and beyond.

How can I add the hours?

-(void)update:(ccTime)dt{

        totalTime += dt;
        currentTime = (int)totalTime;
    if (myTime < currentTime)
{
    myTime = currentTime;
    [countUpTimer setString:[NSString stringWithFormat:@"%02d:%02d", myTime/60, myTime%60]];
}
}


[countUpTimer setString:[NSString stringWithFormat:@"%02d:%02d:%02d", myTime/3600, (myTime/60)%60, myTime%60]];
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜