I would like to animate the counting of digets in a text calculating upwards. The texts is in a UILabel similar like You have driven for 0.0km and that needs to be changed to You have driven for 143.6km with count animation. Is there any way I can update it animated?
I would like to animate the counting of digets in a text calculating upwards. The texts is in a UILabel similar like You have driven for 0.0km and that needs to be changed to You have driven for 143.6km. Is there any way I can update it animated?
I would like to animate the counting of digets in a text calculating upwards. The texts is in a UILabel similar like You have driven for 0.0km and that needs to be changed to You have driven for 143.6km with count animation. Is there any way I can update it animated?
Edit</br/> Here is some of my current code, concerning other animations I already have:
if (animated) { [UIView beginAnimations:@"scaleAnimation" context:nil]; [UIView setAnimationCurve:UIViewAnimationCurveEaseInOut]; [UIView setAnimationDuration:animationDuration]; } [...] // Amount pointer float xForRedBar = redBarFrame.size.width + redBarFrame.origin.x; CGRect pointerFrame = cell.amountBarPointer.frame; pointerFrame.origin.x = (xForRedBar - (pointerFrame.size.width/2)); if (pointerFrame.origin.x < 12) pointerFrame.origin.x = 12; if (pointerFrame.origin.x >= (308 - (pointerFrame.size.width/2))) pointerFrame.origin.x = 308 - pointerFrame.size.width; [cell.amountBarPointer setFrame:pointerFrame]; // Amount bar CGRect amountBarFrame = cell.amountBar.frame; amountBarFrame.origin.x = 9+(((302 - amountBarFrame.size.width)/100)*self.procentCompleted); [cell.amountBar setFrame:amountBarFrame]; // Amount info text CGRect amountInfoFrame = cell.amountInfo.frame; amountInfoFrame.origin.x = amountBarFrame.origin.x + 2; [cell.amountInfo setFrame:amountInfoFrame]; // Amount text [cell.amountInfo setText:[NSString stringWithFormat:NSLocalizedString(@"You have driven for %@km", nil), self.userAmount]]; [...] if (self.procentCompleted == 0) { [cell.amountBar setAlpha:0]; [cell.amountBarPointer setAlpha:0]; [cell.amountInfo setAlpha:0]; } else { [cell.amountBar setAlpha:1]; [cell.amountBarPointer setAlpha:1]; [cell.amountInfo setAlpha:1]; } if (animated) { [UIView commitAnimations]; } Edit</br/> Here is some of my current code, concerning other animations I already have:
if (animated) { [UIView beginAnimations:@"scaleAnimation" context:nil]; [UIView setAnimationCurve:UIViewAnimationCurveEaseInOut]; [UIView setAnimationDuration:animationDuration]; } [...] // Amount pointer float xForRedBar = redBarFrame.size.width + redBarFrame.origin.x; CGRect pointerFrame = cell.amountBarPointer.frame; pointerFrame.origin.x = (xForRedBar - (pointerFrame.size.width/2)); if (pointerFrame.origin.x < 12) pointerFrame.origin.x = 12; if (pointerFrame.origin.x >= (308 - (pointerFrame.size.width/2))) pointerFrame.origin.x = 308 - pointerFrame.size.width; [cell.amountBarPointer setFrame:pointerFrame]; // Amount bar CGRect amountBarFrame = cell.amountBar.frame; amountBarFrame.origin.x = 9+(((302 - amountBarFrame.size.width)/100)*self.procentCompleted); [cell.amountBar setFrame:amountBarFrame]; // Amount info text CGRect amountInfoFrame = cell.amountInfo.frame; amountInfoFrame.origin.x = amountBarFrame.origin.x + 2; [cell.amountInfo setFrame:amountInfoFrame]; // Amount text [cell.amountInfo setText:[NSString stringWithFormat:NSLocalizedString(@"You have driven for %@km", nil), self.userAmount]]; [...] if (self.procentCompleted == 0) { [cell.amountBar setAlpha:0]; [cell.amountBarPointer setAlpha:0]; [cell.amountInfo setAlpha:0]; } else { [cell.amountBar setAlpha:1]; [cell.amountBarPointer setAlpha:1]; [cell.amountInfo setAlpha:1]; } if (animated) { [UIView commitAnimations]; } Update UILabel text animated
I would like to animate the counting of digets in a text calculating upwards. The texts is in a UILabel similar like You have driven for 0.0km and that needs to be changed to You have driven for 143.6km. Is there any way I can update it animated?