I'm having an issue that I have localized to this block of code:
My problem is that the background isn't changing colors when the color depends on the segmented control. I have verified that the code is being run; replacing the if statements with "color = [UIColor someColor];" works fine. Does anyone have an ide why my code isn't working?
Code:
UIColor *color;
NSInteger pressed = ViewTwo.background.selectedSegmentIndex;
//background is an instance of UISegmentedControl
if (pressed == 0) {
color = [UIColor whiteColor];
}
else if (pressed == 1) {
color = [UIColor grayColor];
}
else if (pressed == 2) {
color = [UIColor blackColor];
}
else color = [UIColor whiteColor];
self.window.backgroundColor = color;
My problem is that the background isn't changing colors when the color depends on the segmented control. I have verified that the code is being run; replacing the if statements with "color = [UIColor someColor];" works fine. Does anyone have an ide why my code isn't working?