如何在ios中为collectionviewcell的不同标签设置不同的倒计时计时器?

如何在ios中为collectionviewcell的不同标签设置不同的倒计时计时器?,ios,objective-c,iphone,Ios,Objective C,Iphone,我正在开发一个应用程序,在这个应用程序中,我必须在事件中获得剩余的秒数,这对于所有事件都是不同的,然后我必须打印倒计时时间,即每个collectionviewcell中事件的剩余时间。这里的行数假设为5 - (col *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath static NSString *identifier = @"Cell";co

我正在开发一个应用程序,在这个应用程序中,我必须在事件中获得剩余的秒数,这对于所有事件都是不同的,然后我必须打印倒计时时间,即每个collectionviewcell中事件的剩余时间。这里的行数假设为5

- (col *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath

static NSString *identifier = @"Cell";col *cell = [collectionView dequeueReusableCellWithReuseIdentifier:identifier forIndexPath:indexPath];  
secondsLeft= seconds left depending on data which I can get successfully;

[self start];
cell.lbl_time.text=[NSString stringWithFormat:@"%02d:%02d:%02d", hours, minutes, seconds];
return cell;}   -(void)updateCounter:(NSTimer *)theTimer{
if(secondsLeft > 0 ) {
secondsLeft -- ;
hours = secondsLeft / 3600;
minutes = (secondsLeft % 3600) / 60;
seconds = (secondsLeft %3600) % 60;
//count.text = [NSString stringWithFormat:@"%02d:%02d:%02d", hours, minutes, seconds];

}
else
{
    NSLog(@"Timer Invalidate");
  //  [timer invalidate];
}}    -(void)start{
timer=[NSTimer scheduledTimerWithTimeInterval:1 target:self selector:@selector(updateCounter:) userInfo:nil repeats:YES];}
让我知道我该怎么做。 提前谢谢

可以在viewController的collectionViewCell中引用要更新的标签,或 您可以为CollectionViewCell创建单独的模型,并从ViewController更新模型,并调用collectionView的重载方法。
您的代码的格式可能会稍微好一点。为了解决这个问题,我不知道你们为什么需要更多的定时器。我会在其中重新加载collectionView[self.collectionView重新加载数据];每个细胞都会计算剩余时间。如果我正确理解您的问题,就不需要多个计时器。谢谢您的回复。我想要的是根据collectionviewcell类中标签上事件的剩余秒数显示计时器。