Wie könnte ich das schreiben, wenn sonst die Codeprüfung besser funktioniert? [geschlossen]
Ist dies der beste Weg, um dies zu schreiben, wenn sonst die Code-Überprüfung?
// set the default to Italy if countrySaved is null
if (lang == NULL) {
lang = @"it";
}
// otherwise set the correct lang based on the country chosed and saved in nsuserdefaults
if ([countrySaved isEqual:@"Brazil"]) {
lang = @"br";
}
else if ([countrySaved isEqual:@"Spain"]) {
lang = @"es";
}
else if ([countrySaved isEqual:@"Italy"]) {
lang = @"it";
}
else if ([countrySaved isEqual:@"United States"]) {
lang = @"us";
}
else if ([countrySaved isEqual:@"United Kingdom"]) {
lang = @"uk";
}
danke für jede hilfe