Posted By

tikipatel on 04/04/14


Tagged

UIView shake


Versions (?)

Shake UIView


 / Published in: Objective C
 

  1. CABasicAnimation *animation = [CABasicAnimation animationWithKeyPath:@"position"];
  2. [animation setDuration:0.05];
  3. [animation setRepeatCount:3];
  4. [animation setAutoreverses:YES];
  5. [animation setFromValue:[NSValue valueWithCGPoint:
  6. CGPointMake([<#UIView#> center].x - 5.0f, [<#UIView#> center].y)]];
  7. [animation setToValue:[NSValue valueWithCGPoint:
  8. CGPointMake([<#UIView#> center].x + 5.0f, [<#UIView#> center].y)]];
  9. [[<#UIView#> layer] addAnimation:animation forKey:@"position"];

Report this snippet  

You need to login to post a comment.