Map view annotations with different pin colors

后端 未结 2 542
无人共我
无人共我 2020-11-30 14:32

I have an array with over 200 objects and I am trying to perform a loop through each of them.

Each object will have a yes/no field and I want to display a different

2条回答
  •  感情败类
    2020-11-30 15:06

    MKPinAnnotationView *pin = (MKPinAnnotationView *) [self.mapView dequeueReusableAnnotationViewWithIdentifier: @"id"];
    if (pin == nil)
    {
        pin = [[MKPinAnnotationView alloc] initWithAnnotation: annotation reuseIdentifier: @"id"] ;
    }
    else
    {
        pin.annotation = annotation;
    }
    
    pin.pinTintColor=[UIColor blueColor];
    pin.canShowCallout = true;
    

提交回复
热议问题