I'm trying to make a random image appear on the press of a button. So it generates a random number, and the switch algorithm swaps the chosen image with the one in the imgview. but I want a switch in the settings app to toggle which set of images to use. I know pretty much how to do it...it's just that it doesn't work. I'm missing some syntax thing...Please help, stackoverflow? it's my birthday.
int Number = rand() %30;
NSString *toggleValue = [[NSUserDefaults standardUserDefaults] stringForKey:@"enabled_preference"];
switch (Number) {
if (*toggleValue == 0) {
case 0:
picture.image = [UIImage imageNamed:@"1.png"];
break;
case 1:
picture.image = [UIImage imageNamed:@"2.png"];
break;}
else {
case 0:
picture.image = [UIImage imageNamed:@"3.png"];
break;
case 1:
picture.image = [UIImage imageNamed:@"4.png"];
break;}
}