I am building an app that will feature a series of "splash" images that fade in and out (one at a time) on the first screen. I will paste the code I have pulled together (some by myself, and some with help from others) below. I am getting an error that "request for member 'imageView' not a structure or union".
I am a relative noob at this, but I am sure I am not declaring something correctly or something along those lines... Any help that anyone can give would be GREATLY appreciated..
I am a relative noob at this, but I am sure I am not declaring something correctly or something along those lines... Any help that anyone can give would be GREATLY appreciated..
Code:
BOOL isRunning;
int numTimer;
-(void)viewDidLoad
{
//Creating array with splash images
NSMutableArray * imageViewArray = [[NSMutableArray alloc] init];
for (int i = 0; i < IMAGE_COUNT; i++)
{
UIImageView *imageView = [[UIImageView alloc] initWithFrame:CGRectMake(275, 70, 225, 200)];
imageView.image = [UIImage imageNamed:[NSString stringWithFormat:@"splash_%d.png", i]];
[imageViewArray addObject:imageView];
imageView.alpha = 0;
[self.view addSubview:imageView];
[imageView release];
}
//self.imageView = imageViewArray;
[imageViewArray release];
[NSTimer scheduledTimerWithTimeInterval:5 target:self selector:@selector(timerRunning) userInfo:nil repeats:YES];
numTimer = 0;
isRunning = YES;
//I would fade in the first image right now and then each timer event would just swap images, one fades out and the next fades in
UIImageView *next = [self.imageView objectAtIndex:numTimer];
[UIView beginAnimations:nil context:NULL];
[UIImageView setAnimationCurve:UIViewAnimationCurveLinear];
[UIImageView setAnimationDuration:2.0];
next.alpha = 0.75;
[UIImageView commitAnimations];
}
-(void)timerRunning
{
UIImageView *imageView = [self.imageView objectAtIndex:numTimer];
//fade out current image.....
[UIView beginAnimations:nil context:NULL];
[UIImageView setAnimationCurve:UIViewAnimationCurveLinear];
[UIImageView setAnimationDuration:2.0];
imageView.alpha = 0;
[UIImageView commitAnimations];
//get next image to show
if (numTimer < IMAGE_COUNT)
{
UIImageView *next = [self.imageView objectAtIndex:++numTimer];
//fade in next image...
[UIView beginAnimations:nil context:NULL];
[UIImageView setAnimationCurve:UIViewAnimationCurveLinear];
[UIImageView setAnimationDuration:2.0];
next.alpha = 0.75;
[UIImageView commitAnimations];
}
}