title: Make shake effect for label in ios?
body: <p>Am working with shake effect for label i called the animation while pressing cell in tableview but it is not working.if i call animation in cellForRowAtIndexPath:(NSIndexPath *)indexPath it is working but if i cal it in didSelectRowAtIndexPath:(NSIndexPath *)indexPath it is not working. could any one help me??? thanks in advance</p>
  
  <pre><code>   -(void)shakeAnimation:(UILabel*) label {
      const int reset = 5;
      const int maxShakes = 6;
  
      //pass these as variables instead of statics or class variables if shaking two controls simultaneously
      static int shakes = 0;
      static int translate = reset;
  
      [UIView animateWithDuration:0.09-(shakes*.01) // reduce duration every shake from .09 to .04
                            delay:0.01f//edge wait delay
                          options:(enum UIViewAnimationOptions) UIViewAnimationCurveEaseInOut
                       animations:^{label.transform = CGAffineTransformMakeTranslation(translate, 0);}
                       completion:^(BOOL finished){
                           if(shakes &lt; maxShakes){
                               shakes++;
  
                               //throttle down movement
                               if (translate&gt;0)
                                   translate--;
  
                               //change direction
                               translate*=-1;
                               [self shakeAnimation:label];
                           } else {
                               label.transform = CGAffineTransformIdentity;
                               shakes = 0;//ready for next time
                               translate = reset;//ready for next time
                               return;
                           }
                       }];
  }
  
  -(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
  {
  
      [self shakeAnimation:cell.MyHomeMenuCountlabel];
  
  }
  </code></pre>