I wanted to add an simple picture animation in my app, but its not showing. I get this yellow error saying "local declaration of 'images' hides instance variable"
In the following place: [images addObject:[UIImage imageNamed:[imageNames objectAtIndex:i]]]; }
// Normal Animation
UIImageView *animationImageView = [[UIImageView alloc] initWithFrame:CGRectMake(60, 95, 86, 193)];
animationImageView.animationImages = **images**;
MY CODE:
- (void)viewDidLoad
{
[super viewDidLoad];
// Load images
NSArray *imageNames = @[@"1.png", @"2.png", @"3.png", @"4.png",
@"5.png", @"6.png"];
NSMutableArray *images = [[NSMutableArray alloc] init];
for (int i = 0; i < imageNames.count; i++) {
[images addObject:[UIImage imageNamed:[imageNames objectAtIndex:i]]];
}
// Normal Animation
UIImageView *animationImageView = [[UIImageView alloc] initWithFrame:CGRectMake(60, 95, 86, 193)];
animationImageView.animationImages = images;
animationImageView.animationDuration = 0.5;
[self.view addSubview:animationImageView];
[animationImageView startAnimating];
}