How to animate an UILabel from small to its original size?

200 views Asked by At

Actually i am using RESlider in my app. In the menu table view there is a profile image and aside to it there is a notification label. Now i want is that when the user presses the hamburger menu the notification label(orange label with 999 number) should animate from a tiny dot to its original size. How to achieve this?? enter image description here

3

There are 3 answers

1
Leo On BEST ANSWER

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) {

    }];
}
1
ejanowski On

Change the transform scale of your label, like this :

[UIView animateWithDuration:0.5
                          delay:0.0
                        options:UIViewAnimationOptionAutoreverse | UIViewAnimationOptionRepeat | UIViewAnimationOptionCurveEaseInOut
                     animations:^{
                         timerLabel.transform = CGAffineTransformScale(timerLabel.transform, 0.7, 0.7);
                     }
                     completion:nil];
0
Nimit Parekh On
   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);
                 }];