use*_*261 9 iphone nstimer countdown
我设置了我的计时器代码,它都是犹太洁食,但我希望我的标签显示"分钟:秒"而不是秒.
-(void)countDown{
time -= 1;
theTimer.text = [NSString stringWithFormat:@"%i", time];
if(time == 0)
{
[countDownTimer invalidate];
}
}
Run Code Online (Sandbox Code Playgroud)
我已经将"时间"设置为600或10分钟.但是,我希望显示屏显示10:59,10:58等,直到它达到零.
我该怎么做呢?
谢谢!
Noa*_*oon 19
int seconds = time % 60;
int minutes = (time - seconds) / 60;
theTimer.text = [NSString stringWithFormat:@"%d:%.2d", minutes, seconds];
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
6407 次 |
| 最近记录: |