简体   繁体   中英

How to animate uitext label when there is a change in text?

I want to animate a text label when there is a change in it. For ex, I got a price label which will be changed(dropped) regarding to the time. If price is 100.25 and dropped to 100.24, I want to animate last digit.

Is there a good animation library for the purpose I mention?

Thanks

Try this

You can use Fade effect

CATransition *animation = [CATransition animation];
animation.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut];
animation.type = kCATransitionFade;
animation.duration = 0.75;
[aLabel.layer addAnimation:animation forKey:@"kCATransitionFade"];

// This will fade:
aLabel.text = xxx

Hope this helps.

//Try This One Hope So Helpful
  • (void)animateLabelShowText:(NSString*)newText characterDelay:(NSTimeInterval)delay { [self.myLabel setText:@""];

    for (int i=0; i

     [NSThread sleepForTimeInterval:delay]; 

    } }

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM