I get a memory warning using 100 animated images, so I tried using Core Animation, but this gives me the same problem. This is because I do not know how to use replaceSublayer in my current code
UIView* upwardView=[[UIView alloc]init]; [upwardView setFrame:CGRectMake(0, 0, 1024, 768)]; [self.view addSubview:upwardView]; NSArray *animationImages=[NSArray arrayWithObjects:[UIImage imageNamed:@"001.png"],[UIImage imageNamed:@"001.png"],[UIImage imageNamed:@"002.png"],[UIImage imageNamed:@"003.png"],....,nil]; CAKeyframeAnimation *animationSequence = [CAKeyframeAnimation animationWithKeyPath: @"contents"]; animationSequence.calculationMode = kCAAnimationLinear; animationSequence.autoreverses = YES; animationSequence.duration = 5.00; animationSequence.repeatCount = HUGE_VALF; NSMutableArray *animationSequenceArray = [[NSMutableArray alloc] init]; for (UIImage *image in animationImages) { [animationSequenceArray addObject:(id)image.CGImage]; } CALayer *layer = [upwardView layer]; animationSequence.values = animationSequenceArray; [layer addAnimation:animationSequence forKey:@"contents"];
user2787066
source share