Question

Im trying to call this method twice using perform selector

-(void)time:(UILabel *)label{


  float duration = (label.frame.size.width + self.view.frame.size.width)/111;
  [UIView beginAnimations:nil context:nil];
  [UIView setAnimationDuration:duration];
  [UIView setAnimationCurve:UIViewAnimationCurveLinear];
  [UIView setAnimationRepeatCount:1e100f];
  label.center = CGPointMake(label.center.x , label.center.y +700);
  [UIView commitAnimations];

}

using perform selector but only once it is being called.

[self performSelector:@selector(time:) withObject:testLabel afterDelay:0];

[self performSelector:@selector(time:) withObject:testLabel1 afterDelay:5];

Only the first one is called. Am I doing it wrong?

Was it helpful?

Solution

Use timer 2 call function twice after 2 time invalidate the timer

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top