I need some help with my code.
I have an UIAlert that pops up the first time that you open the app, in that pop up I have two buttons and the user will choose one of those. I want the app to remember what button the user chose to execute some code or other. The thing is I have this code right here :
-(void)changeLabel{
progressView.progress += 0.25;
scan.hidden = YES;
if (progressView.progress == 1 ) {
label.hidden = YES;
progressView.hidden = YES;
[timer invalidate];
imagesText.hidden = NO;
int randomNumber = arc4random() % 4;
switch (randomNumber) {
case 0:
imagesText.image = [UIImage imageNamed:@"image1.png"];
break;
case 1:
imagesText.image = [UIImage imageNamed:@"image2.png"];
break;
case 2:
imagesText.image = [UIImage imageNamed:@"image3.png"];
break;
case 3:
imagesText.image = [UIImage imageNamed:@"image4.png"];
default:
break;
}
}
}
So I want to make it in some way that if the user selected the first button the app will do the switch between cases 0,1 and 2 and if he selected the second button it'll do it between 3 and others. But I want the beginning of the code to be the same for both cases.
I tried some stuff but it doesn't work how I wanted.
Thank you for your help!
No comments:
Post a Comment