【发布时间】:2017-04-20 07:54:17
【问题描述】:
我得到毫秒,我想将该毫秒转换为天、小时、分钟、秒并显示并希望在 uiTableview 中显示它。我想每秒更新一次那个计时器..
我曾使用 uiTableview 委托方法 cellForRowAtIndexPath 尝试过这段代码。
NSInteger totleTime = [[[productListDataArray objectAtIndex:indexPath.row]objectForKey:@"_auction_duration"] integerValue];
totleTime = totleTime - timerValue ;
long days = (totleTime) / (60 * 60 * 24);
long hours = (totleTime - days * 60 * 60 * 24) / (60 * 60);
long minuts = (totleTime - days * 60 * 60 * 24 - hours * 60 * 60) / 60;
long seconds = (totleTime - days * 60 * 60 * 24 - hours * 60 *60 - minuts * 60);
NSLog(@"seconds : %.f minutes : %.f hours : %.f days : %.f ", seconds, minuts, hours, days);
我曾经用这个方法来调用方法和更新tableview。但它不起作用所以建议我另一种选择或告诉我我在这段代码中做错了什么..
【问题讨论】:
标签: uitableview nstimer countdown nstimeinterval