Hi all,
I have set up application settings for a project and created the same settings as a view in the app. All this works a treat. I am now trying to add a calculation that reads one of the settings and displays an image based on whether the setting is on or off.
Currently, my code is this:
I get an error for each of the 'return' lines: Expected ")" before 'tempImageView'. The last line also says it's not declared, but this probably relates to the first issue.
I have been through it many times and am probably not seeing the wood for the trees, as they say. Could anyone give me a hand in understanding what the issue is?
I have set up application settings for a project and created the same settings as a view in the app. All this works a treat. I am now trying to add a calculation that reads one of the settings and displays an image based on whether the setting is on or off.
Currently, my code is this:
Code:
//Check the map to use
NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
BOOL enabled = [defaults boolForKey:@"maptype"];
if (enabled) {
return (UIImageView *tempImageView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"map2.jpg"]]);
} else {
return (UIImageView *tempImageView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"map1.jpg"]]);
}
self.imageView = tempImageView;
I get an error for each of the 'return' lines: Expected ")" before 'tempImageView'. The last line also says it's not declared, but this probably relates to the first issue.
I have been through it many times and am probably not seeing the wood for the trees, as they say. Could anyone give me a hand in understanding what the issue is?