Note that there are some explanatory texts on larger screens.

plurals
  1. POcannot populate 2 colours in mapkit
    text
    copied!<p>Somebody please help.. =( </p> <p>I tried numerous methods to no avail. In my _annotation2 array there are 18 clinics pinpoints and 1 user which I need to populate on the map. However, no matter how I change the codes the pinpoint always come out to be the same color. I am at end wits as i have explored this for a long time with numerous tutorials with no avail. </p> <p>can some1 plz guide me along.. below is my method to customize the map.. Somebody save me =(</p> <pre><code> - (MKAnnotationView *)mapView:(MKMapView *)mapView viewForAnnotation:(id &lt;MKAnnotation&gt;)annotation { //NSLog(@"welcome into the map view annotation"); for(int i = 0; i&lt;[_annotation2 count]; i++){ MyAnnotation* a = [_annotation2 objectAtIndex:i]; MKPinAnnotationView *pinView=[[MKPinAnnotationView alloc] initWithAnnotation:a reuseIdentifier:[annotation title]]; pinView.animatesDrop=YES; pinView.canShowCallout=YES; pinView.pinColor = MKPinAnnotationColorRed; return [pinView autorelease]; UIButton* rightButton = [UIButton buttonWithType:UIButtonTypeDetailDisclosure]; [rightButton setTitle:annotation.title forState:UIControlStateNormal]; [rightButton addTarget:self action:@selector(showDetails:) forControlEvents:UIControlEventTouchUpInside]; pinView.rightCalloutAccessoryView = rightButton; UIImageView *profileIconView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"profile.png"]]; pinView.leftCalloutAccessoryView = profileIconView; [profileIconView release]; return pinView; } MyAnnotation *b = [_annotation2 objectAtIndex:[_annotation2 count ]-1]; MKPinAnnotationView *pinView2=[[MKPinAnnotationView alloc] initWithAnnotation:b reuseIdentifier:[annotation title]]; pinView2.animatesDrop=YES; pinView2.canShowCallout=YES; pinView2.pinColor = MKPinAnnotationColorGreen; return [pinView2 autorelease]; UIButton* rightButton = [UIButton buttonWithType:UIButtonTypeDetailDisclosure]; [rightButton setTitle:annotation.title forState:UIControlStateNormal]; [rightButton addTarget:self action:@selector(showDetails:) forControlEvents:UIControlEventTouchUpInside]; pinView2.rightCalloutAccessoryView = rightButton; UIImageView *profileIconView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"profile.png"]]; pinView2.leftCalloutAccessoryView = profileIconView; [profileIconView release]; return pinView2; </code></pre> <p>}</p> <p>I try this new set of codes but it still doesnt work =(</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload