Note that there are some explanatory texts on larger screens.

plurals
  1. POresume animation app if app enter foreground ios
    text
    copied!<p>I have a small problem, when my application enter the background the animation stop and don't resume when the application goes back to the foreground.</p> <p>I have tried this:</p> <pre><code>@implementation startViewController -(void)animation { UIImage*img1 = [UIImage imageNamed:@"wolk2.png"]; image1 = [[UIImageView alloc]initWithImage:img1]; image1.frame = CGRectMake(0, 0, 400, 200); UIImage*img2= [UIImage imageNamed:@"wolk1.png"]; image2 = [[UIImageView alloc]initWithImage:img2]; image2.frame = CGRectMake(0, 0, 220, 100); [self.imageView addSubview:image1]; [self.imageView addSubview:image2]; [[self imageView]sendSubviewToBack:image1]; [[self imageView]sendSubviewToBack:image2]; CGFloat a = (CGFloat) (100); CGFloat b = (CGFloat) (100); CGFloat a1 = (CGFloat) (50); CGFloat b1 = (CGFloat) (350); CGPoint startPointOne=CGPointMake(a,b); CGPoint startPointTwo=CGPointMake(a1,b1); image1.center=startPointOne; image2.center=startPointTwo; [UIView beginAnimations:nil context:NULL]; [UIView setAnimationDuration:20]; [UIView setAnimationCurve: UIViewAnimationCurveLinear]; [UIView setAnimationRepeatAutoreverses:YES]; [UIView setAnimationRepeatCount:100000]; CGFloat c = (CGFloat) (700); CGFloat d = (CGFloat) (100); CGPoint endPointOne=CGPointMake(c,d); image1.center = endPointOne; [UIView commitAnimations]; [UIView beginAnimations:Nil context:NULL]; [UIView setAnimationDuration:30]; [UIView setAnimationCurve: UIViewAnimationCurveLinear]; [UIView setAnimationRepeatAutoreverses:YES]; [UIView setAnimationRepeatCount:100000]; CGFloat c1 = (CGFloat) (650); CGFloat d1 = (CGFloat) (350); CGPoint endPointTwo=CGPointMake(c1,d1); image2.center = endPointTwo; [UIView commitAnimations]; } </code></pre> <p>Then in the app delegate I have enter this:</p> <pre><code> - (void)applicationDidBecomeActive:(UIApplication *)application { start = [[startViewController alloc]init]; [start animation]; } </code></pre> <p>But this didn't work, so what should I do to resume the animation?</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload