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++;
break;
default:
break;
}
}
if (hundredths == 100) {
seconds++;
hundredths = 0;
}
else if (seconds == 60) {
minutes++;
seconds = 0;
minutes = 0;
}
self.hr.text = [NSString stringWithFormat:@"%.0d", hours];
self.min.text = [NSString stringWithFormat:@"%.2d", minutes];
}
当我执行此代码时,在 for 循环中出现异常错误。我该如何克服这个问题。请建议我。先感谢您