我创建了一个从 10 到 0 的倒数计时器。我创建了一个以秒为单位显示计数器的 uilabel。现在我希望标签显示计数器分钟和秒,就像这样:00:00。我怎样才能做到这一点?这是我的倒计时代码:
-(void)countdown
{
countdownCounter -= 1;
countdown.text = [NSString stringWithFormat:@"%i", countdownCounter];
}
-(IBAction)strat:(id)sender
{
countdownCounter = 10;
countdownTimer = [NSTimer scheduledTimerWithTimeInterval:1.0 target:self selector:@selector(countdown) userInfo:nil repeats:YES];
}
}
谢谢!