这个定时器在我所有的设备(5 个、Ipad 和两个 4S)上都很好用,但它似乎不适用于我拥有的两个 3GS。出于某种原因,3s 上的时间真的很慢。这是解释问题的视频:
这是处理时间的代码:
- (void)showTime
{
int hours = 0;
int minutes = 0;
int seconds = 0;
int hundredths = 0;
NSArray *timeArray = [NSArray arrayWithObjects:self.hun.text, self.sec.text, self.min.text, self.hr.text, nil];
for (int i = [timeArray count] - 1; i >= 0; i--) {
int timeComponent = [[timeArray objectAtIndex:i] intValue];
switch (i) {
case 3:
hours = timeComponent;
break;
case 2:
minutes = timeComponent;
break;
case 1:
seconds = timeComponent;
break;
case 0:
hundredths = timeComponent;
hundredths++;
score++;
break;
default:
break;
}
}
if (hundredths == 100) {
seconds++;
hundredths = 0;
}
else if (seconds == 60) {
minutes++;
seconds = 0;
}
else if (minutes == 60) {
hours++;
minutes = 0;
}
self.hr.text = [NSString stringWithFormat:@"%.0d", hours];
self.min.text = [NSString stringWithFormat:@"%.2d", minutes];
self.sec.text = [NSString stringWithFormat:@"%.2d", seconds];
self.hun.text = [NSString stringWithFormat:@"%.2d", hundredths];
scoreLabel.text= [NSString stringWithFormat:@"%i",score];
请帮我弄清楚这里发生了什么。它在较新的设备上运行良好,我只是迷失了我需要做的事情。
先感谢您!