UIView animation using 90%CPU

hi i have animation which loop but are using 90% of my iphone CPU processing and are heating up the phone. what have i done wrong ?

anybody can give me some advise ?

  • Chat send animation like iMessage
  • How to Animate a UIBezierPath
  • iOS 9 Orientation Auto-Rotation Animation Not Working, But Always on Main Thread
  • Avoid animation of UICollectionView after reloadItemsAtIndexPaths
  • How do you achieve a “clock wipe”/ radial wipe effect in iOS?
  • MKAnnotation not getting selected in iOS5
  • thanks

    -(void)nextAnimation:(float)previousWidth {
    
    //picture loop
    imageViewTop.image = imageViewBottom.image;
    imageViewBottom.image = [imageArray objectAtIndex:[imageArray count] - 1];
    
    [imageArray insertObject:imageViewBottom.image atIndex:0];
    [imageArray removeLastObject];
    imageViewTop.alpha = 1.0;
    imageViewBottom.alpha = 0.0;
    
    [UIView animateWithDuration:4.0
                     animations:^{ 
                         imageViewTop.alpha = 0.0;
                         imageViewBottom.alpha = 1.0;
                         } 
                     completion:^(BOOL  completed){
                         [self nextAnimation:stringsize.width];
                     }
     ]; 
    

    Solutions Collect From Internet About “UIView animation using 90%CPU”

    You got a infinite loop in you code. You must have a quit condition to avoid infinite loop. A static counter is zero, and run one time add 1, if counter > n quit.