I’m using NSUserDefaults to save an integer on another view controller so that when this one is pushed I know which image to use. For some reason the simulator only uses image1 while my phone only uses image2. What can I do?
if ([[NSUserDefaults standardUserDefaults] integerForKey:@"key"] == 1){
leftStill = [UIImage imageNamed:@"image1.png"];
}
if ([[NSUserDefaults standardUserDefaults] integerForKey:@"key"] == 2) {
leftStill = [UIImage imageNamed:@"image2.png"];
}
[imageView setImage:leftStill];
Did you call
- (BOOL)synchronize;after setting the value in NSUserDefaults?