3

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

User1075
  • 819
  • 15
  • 36

3 Answers3

2
   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);
                 }];
Nimit Parekh
  • 16,776
  • 8
  • 50
  • 72
2

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

    }];
}
Leo
  • 24,596
  • 11
  • 71
  • 92
  • I would change `self.label.transform = CGAffineTransformMakeScale(1.0, 1.0)` to `self.label.transform = CGAffineTransformIdentity` – NKorotkov Jun 11 '15 at 10:24
1

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];
ejanowski
  • 538
  • 5
  • 20