Hi, I have made a settings bundle for my app containing several NSStrings. I then have an if statement where I want it to do one thing if there is ANYTHING entered into that field, and something else if there is NOTHING in that field. Can't seem to get it to work properly though. Any tips?
Code:
if ([[NSUserDefaults standardUserDefaults] stringForKey:(@"supervisor_email")]) {
[supervisorsEmail setFont:[UIFont italicSystemFontOfSize:(8)]];
[supervisorsEmail setText:[defaults stringForKey:@"supervisor_email"]];
} else {
[supervisorsEmail setTextColor:[UIColor redColor]];
[supervisorsEmail setText:@"Not Set Yet"];
UIAlertView *supervisorEmail = [[[UIAlertView alloc]
initWithTitle:@"SUPERVISOR'S EMAIL"
message:@"You have not assigned a supervisor's email address yet. This is required to email the report. Please go to you iPhone settings."
delegate:self
cancelButtonTitle:@"Dismiss"
otherButtonTitles:nil] autorelease];
[supervisorEmail setTag:4];
[supervisorEmail show];
};
Quote:
|
I have also tried boolForKey, but, either way I do it, it always returns the same result. Any advice?
|