How to animate a UILabel from small to original size?

I am actually using RESlider in my application. There is a profile picture in the menu table view, and there is a notification label on the side. Now I want that when the user clicks the hamburger menu, the notification label ( orange label numbered 999 ) should animate from a tiny dot to its original size. How can this be achieved? enter image description here

+3


source to share


3 answers


Put this in viewDidAppear



-(void)viewDidAppear:(BOOL)animated{
     self.label.transform = CGAffineTransformMakeScale(0.01, 0.01);
    [UIView animateWithDuration:0.5 animations:^{
        self.label.transform = CGAffineTransformIdentity;
    } completion:^(BOOL finished) {

    }];
}

      

+2


source


   myTextLabel.transform = CGAffineTransformMakeScale(0.3, 0.3);
[UIView animateWithDuration:2.0
                      delay: 0.1
                    options: UIViewAnimationOptionBeginFromCurrentState
                 animations:^{
                     myTextLabel.transform = CGAffineTransformMakeScale(1.5, 1.5); //grow
                 }
                 completion:^(BOOL finished){
                     myTextLabel.transform = CGAffineTransformMakeScale(1, 1);
                 }];

      



+2


source


Change the transformation scale of your label, for example:

[UIView animateWithDuration:0.5
                          delay:0.0
                        options:UIViewAnimationOptionAutoreverse | UIViewAnimationOptionRepeat | UIViewAnimationOptionCurveEaseInOut
                     animations:^{
                         timerLabel.transform = CGAffineTransformScale(timerLabel.transform, 0.7, 0.7);
                     }
                     completion:nil];

      

+1


source







All Articles