Drawing Annotations to Map? Help!!

Joined
Mar 8, 2011
Messages
4
Reaction score
0
Points
1
So I have a problem. I'm making an app in which I need to have multiple annotations of different colors on a MapView object. But when I draw the annotations to the map, only one appears. I've implemented the appropriate protocols and overridden the viewForAnnotation method that draws points to the screen. But still only one lonesome annotation gets drawn!

The method updateNodes is supposed to go through an array called allParties, and populate another array called arr with annotation objects. I then attempt do draw the array of annotations using the addAnnotations method.

Here's my code:
Code:
-(void) updateNodes{
    NSMutableArray *arr = [[NSMutableArray alloc] init];
    for(Party *party in allParties){
        if(!party.alreadyAdded){
            party.alreadyAdded = YES;
             MKAnnotationView *partyPin = [self returnPointView:[party getPartylocation] 	     andTitle:[party getPartyName] andColor:[party getPartyColor]];
            [partyPin.annotation setCoordinate:partyPin.annotation.coordinate];
            [arr addObject:partyPin.annotation];
            NSLog(@"Adding Successful!");
        }
    }
    [self.map addAnnotations:arr];
}
-(MKAnnotationView *)mapView:(MKMapView *)mV viewForAnnotation:(id <MKAnnotation>)annotation{
    NSLog(@"Map View Method Called");
    MKPinAnnotationView *pinView = [[MKPinAnnotationView alloc] initWithAnnotation:annotation reuseIdentifier:nil];
    return pinView;
}


I'm clearly doing something wrong. How can I get it so that:

(a) The annotations are of different colors (meaning multiple-colored annotations)
(b) The annotations actually are on the map!
 

Shop Amazon


Shop for your Apple, Mac, iPhone and other computer products on Amazon.
We are a participant in the Amazon Services LLC Associates Program, an affiliate program designed to provide a means for us to earn fees by linking to Amazon and affiliated sites.
Top