I'm testing a code that i've found on a tutorial, for an animated png. This is the code:
But I don't see the animation, but only the next view. Why? How i can fix this? Thanks
Code:
- (void)viewDidLoad
{
[super viewDidLoad];
// Animazione intro
// Load images
NSArray *imageNames = @[@"1.png", @"2.png", @"3.png", @"4.png",
@"5.png", @"6.png", @"7.png", @"8.png",
@"9.png", @"10.png", @"11.png", @"12.png",
@"13.png", @"14.png", @"15.png", @"16.png"];
NSMutableArray *images = [[NSMutableArray alloc] init];
for (int i = 0; i < imageNames.count; i++) {
[images addObject:[UIImage imageNamed:[imageNames objectAtIndex:i]]];
NSLog(@"%d", i);
}
// Normal Animation
UIImageView *animationImageView = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, 1024, 768)];
animationImageView.animationImages = images;
animationImageView.animationDuration = 8;
animationImageView.animationRepeatCount = 1;
animationImageView.image = [animationImageView.animationImages lastObject];
[self.view addSubview:animationImageView];
[animationImageView startAnimating];
UIStoryboard *sb = [UIStoryboard storyboardWithName:@"Main" bundle:nil];
UIViewController *vc = [sb instantiateViewControllerWithIdentifier:@"SecondaSchermata"];
[[[[UIApplication sharedApplication] delegate] window] setRootViewController:vc];
}
But I don't see the animation, but only the next view. Why? How i can fix this? Thanks
Last edited by a moderator: