Hi everyone, i am just having some trouble with some code:
Code:
- (void) BG {
BOOL greenBGAp = [[NSUserDefaults standardUserDefaults] boolForKey:@"greenBGAp"];
BOOL blueBGAp = [[NSUserDefaults standardUserDefaults] boolForKey:@"blueBGAp"];
if (greenBGAp == TRUE) {
BG.image = [UIImage imageNamed:@"greenBG.png"];
} else {
BG.image = [UIImage imageNamed:@"BG.jpg"];
}
if (blueBGAp == TRUE) {
BG.image = [UIImage imageNamed:@"blueBG.png"];
} else {
BG.image = [UIImage imageNamed:@"BG.jpg"];
}
}
it doesn't work, and i know why but i can't seem to fix it.
problem 1: with both of those if statements the greenBG never shows up because if blueBGAp is 0 and greenBGAp is 1 it is BG.jpg because of the second if statement.
problem 2: obviesly if one of the BOOLs is TRUE i want the other BOOLS FALSE. but as you can see if the other BOOLs are FALSE it changes to BG.jpg.
thank you to all the smart people who help solve this problem!
by the way i am going to have a whole bunch more colors but i don't want to move on untill i get this problem solved.