Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on May 8th, 2012  |  syntax: None  |  size: 1.27 KB  |  hits: 12  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. UIView Animation Blocks Crash in Instruments Only
  2. CGRect frame = self.buzzMeBtn.frame;
  3.  
  4. frame.origin.x = 105.0f;
  5. frame.origin.y = 200.0f;
  6. self.buzzMeBtn.frame = frame;
  7. self.buzzMeBtn.hidden = NO;
  8. frame.origin.y = 120.0f;
  9. [UIView animateWithDuration:.15f animations:^(void){
  10.  
  11.     self.buzzMeBtn.frame = frame;
  12. } completion:^(BOOL finished){
  13.  
  14.     // Define the three stages of the animation in forward order
  15.     AnimationBlock makeSmall = ^(void){
  16.         self.buzzMeBtn.transform = CGAffineTransformMakeScale(0.6f, 0.6f);};
  17.     AnimationBlock makeLarge = ^(void){
  18.         self.buzzMeBtn.transform = CGAffineTransformMakeScale(1.15f, 1.15f);};
  19.     AnimationBlock restoreToOriginal = ^(void) {
  20.         self.buzzMeBtn.transform = CGAffineTransformIdentity;};
  21.  
  22.     // Create the completion blocks in reverse order
  23.     CompletionBlock shrinkBack = ^(BOOL finished) {
  24.         [UIView animateWithDuration:0.2f animations:restoreToOriginal];};  
  25.         //[UIView animateWithDuration:0.2f animations:restoreToOriginal completion: reenable];};  
  26.     CompletionBlock bounceLarge = ^(BOOL finished){
  27.         [UIView animateWithDuration:0.2 animations:makeLarge completion:shrinkBack];};
  28.  
  29.     // Start the animation
  30.     [UIView animateWithDuration: 0.1f animations:makeSmall completion:bounceLarge];
  31. }];