iOS 硬件 大头针 - 终极 - 自定义样式

来源:互联网 发布:郑州软件 编辑:程序博客网 时间:2024/05/17 13:40

#pragma -mark ======================================终极 自定义大头针


- (
MKAnnotationView*)mapView:(MKMapView*)mapView viewForAnnotation:(id<MKAnnotation>)annotation{

   
MKAnnotationView *annotationView = [mapViewdequeueReusableAnnotationViewWithIdentifier:@"annotationView"];

   
if(annotationView ==nil){

        annotationView = [[
MKAnnotationViewalloc]initWithAnnotation:annotationreuseIdentifier:@"annotationView"];


    }

    annotationView.
annotation= annotation;

    annotationView.
canShowCallout= YES;

    annotationView.
draggable= YES;

    annotationView.
image= [UIImageimageNamed:@"1"];

   
UIImageView *lefteftCalloutAccessoryView = [[UIImageViewalloc]initWithFrame:CGRectMake(0,0,40,40)];

    lefteftCalloutAccessoryView.
image= [UIImageimageNamed:@"flag3_right_azure.png"];

    annotationView.
leftCalloutAccessoryView= lefteftCalloutAccessoryView;


   
return annotationView;
}
0 0
原创粉丝点击