Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to show count down timer on cell in iphone?
    primarykey
    data
    text
    <p>** I show count down timer on cell when i long press on cell.but the problem is that when i click on row timer started but suddenly when i click on second cell timer stop of previous cell and start timer new cell which i click ,but the main functionality which i need is that i have to show running previous timer and current timer . please any one give me right way for that.** </p> <pre><code> -(void)handleLongPress:(UILongPressGestureRecognizer *)gestureRecognizer { AppDelegate *app=(AppDelegate *)[UIApplication sharedApplication].delegate; CGPoint p = [gestureRecognizer locationInView:ChatTable]; NSIndexPath *indexPath = [ChatTable indexPathForRowAtPoint:p]; if ([[[userArray valueForKey:@"sender_id"] objectAtIndex:indexPath.row]isEqualToString: app.userId]) { } else{ if (gestureRecognizer.state == UIGestureRecognizerStateBegan) { if ([imageCache objectForKey:[NSString stringWithFormat:@"%d",indexPath.row]]==NULL) { } else { self.picId=[[userArray valueForKey:@"pic_id"] objectAtIndex:indexPath.row]; self.imageName=[[userArray valueForKey:@"imagename"] objectAtIndex:indexPath.row]; ChatTable.userInteractionEnabled=NO; // self.navigationController.navigationBarHidden=YES; image=[[UIImageView alloc]initWithFrame:CGRectMake(0, 0, 320, 480)]; self.pickerValue=[[userArray valueForKey:@"seconds"] objectAtIndex:indexPath.row]; image.image=[imageCache objectForKey:[NSString stringWithFormat:@"%d",indexPath.row]]; [self.view addSubview:image]; [self showTableTime:indexPath]; } } else if (gestureRecognizer.state == UIGestureRecognizerStateEnded) { UITableViewCell * myCell = [ChatTable cellForRowAtIndexPath:indexpathForTimer]; UILabel * myLabel = (UILabel *)[myCell viewWithTag:101]; myLabel.text=@""; // self.navigationController.navigationBarHidden=NO; [image removeFromSuperview]; } } } -(void)showTableTime:(NSIndexPath *)indexPath { secondsLeft=[self.pickerValue integerValue]; indexpathForTimer=indexPath; [self countDownTimer]; } - (void)countDownTimer { timer =[NSTimer scheduledTimerWithTimeInterval:1.0 target:self selector:@selector(updateCounter:) userInfo:nil repeats:YES]; } - (void)updateCounter:(NSTimer *)theTimer { UITableViewCell * myCell = [ChatTable cellForRowAtIndexPath:indexpathForTimer]; UILabel * myLabel = (UILabel *)[myCell viewWithTag:101]; if (secondsLeft &gt;0) { secondsLeft --; UILabel * myLabel = (UILabel *)[myCell viewWithTag:101]; myLabel.text=[NSString stringWithFormat:@"0%d",secondsLeft]; } else if(secondsLeft==0) { [self.image removeFromSuperview]; [timer invalidate]; ChatTable.userInteractionEnabled=YES; myLabel.text=@""; [self SendRequsetToServerOfSeenImage]; } else { } } </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload