Getting the error above causing my iOS app to crash. Never seen this before and was wondering if anyone could help me? I'm new to coding and taking on my first app without following lessons/tutorials.
It appears on the second line with the
What i have is an array called mainImages.
That array holds objects which have a property of UIImage called mainTextImage. Inside this method, I am trying to set mainTextImage equal to mainImageView.image so that when this method is called, one of those images are randomly selected to be displayed in the mainImageView.
My array looks like this (inside another class file)
Thanks!
Code:
-(void)updateGamePlay {
int numberOfImages = (int)[self.mainImages count];
int randomIndex = arc4random() % numberOfImages;
MainImage *imageView = [self.mainImages objectAtIndex:randomIndex];
self.mainImageView.image = imageView.mainTextImage;
}
It appears on the second line with the
Code:
int randomIndex = arc4random() % numberOfImages;
What i have is an array called mainImages.
That array holds objects which have a property of UIImage called mainTextImage. Inside this method, I am trying to set mainTextImage equal to mainImageView.image so that when this method is called, one of those images are randomly selected to be displayed in the mainImageView.
My array looks like this (inside another class file)
Code:
- (NSArray *)mainImages {
NSArray *mainImages = [[NSArray alloc] initWithObjects:
[UIImage imageNamed:@"purpleText.png"]
,[UIImage imageNamed:@"whiteText.png"]
,[UIImage imageNamed:@"blackText.png"]
,nil];
return mainImages;
}
Thanks!