Not sure where I'm going wrong. I have an array that contains up to 3 objects. I want to check if any of the arrays objects go on past 0, & if so, format them as an NSString
. If not, I want to include the object at index 0.
A point in the right direction would be great!
// add annotation
MKPointAnnotation *point = [MKPointAnnotation new];
point.coordinate = (CLLocationCoordinate2D){[self.eventPlan.location_lat doubleValue], [self.eventPlan.location_lng doubleValue]};
NSArray *locationA = [self.eventPlan.location_address componentsSeparatedByString:@", "];
point.title = locationA[0];
if ([locationA containsObject:locationA[1]]) {
point.subtitle = [NSString stringWithFormat:@"%@, %@", locationA[1], locationA[2]];
} else {
point.subtitle = [NSString stringWithFormat:@"%@", locationA[1]];
}
[mapView addAnnotation:point];