try this one.. if placemark.subAdministrativeArea
is nil
then you can write your own string in if condition otherwise set the value of placemark.subAdministrativeArea
to the string variable and assign that to UILable
...
UPDATE:
NSMutableString *strLblTexts = [[NSMutableString alloc] init];
if (placemark.country != nil) {
[strLblTexts appendString:placemark.country];
}
if (placemark.subAdministrativeArea != nil) {
if ([strLblTexts isEqualToString:@""]||[strLblTexts isEqual:nil]) {
[strLblTexts appendString:placemark.subAdministrativeArea];
}
else{
NSString *strtemp=[NSString stringWithFormat:@",%@",placemark.subAdministrativeArea];
NSLog(@">>>>>>>>>>>>> str temp :%@", strtemp);
[strLblTexts appendString:strtemp];
}
}
if (placemark.subLocality != nil) {
if ([strLblTexts isEqualToString:@""]||[strLblTexts isEqual:nil]) {
[strLblTexts appendString:placemark.subLocality];
}
else{
NSString *strtemp=[NSString stringWithFormat:@",%@",placemark.subLocality];
NSLog(@">>>>>>>>>>>>> str temp :%@", strtemp);
[strLblTexts appendString:strtemp];
}
}
Do same like another 3 field and at last set that value to the UILable
like bellow...
placeLabel.text = strLblTexts;