1
我使用下面的代码在Xcode:语法错误日期计算
(void)updateLabel
{
NSDate* now = [NSDate date];
int hour = 23 - [[now dateWithCalendarFormat:nil timeZone:nil] hourOfDay];
int min = 59 - [[now dateWithCalendarFormat:nil timeZone:nil] minuteOfHour];
int sec = 59 - [[now dateWithCalendarFormat:nil timeZone:nil] secondOfMinute];
countdownLabel.text = [NSString stringWithFormat:@"%02d:%02d:%02d", hour, min,sec];
}
而且正在以下错误。我怎样才能解决这个问题?
error: invalid operands to binary - (have 'int' and 'id')
这行给出你的错误? –
全部三个.......其中int用于小时,分钟,秒 –
我在我的系统中尝试了相同的代码,它工作良好。 –