MKPinAnnotationView引脚的宽度和高度(以像素为单位)是多少?

编辑:更具体地讲,在iPhone屏幕上包含该图钉的假想矩形的宽度和高度。

最佳答案

根据下面的代码,引脚图像和MKPinAnnotationView均为32点宽和39点高:

- (MKAnnotationView *)mapView:(MKMapView *)mapView
        viewForAnnotation:(id <MKAnnotation>)annotation
{
    MKPinAnnotationView *pav = (MKPinAnnotationView *)[mapView
            dequeueReusableAnnotationViewWithIdentifier:@"test"];
    if (pav == nil)
    {
        pav = [[[MKPinAnnotationView alloc] initWithAnnotation:annotation
                reuseIdentifier:@"test"] autorelease];
    }

    pav.annotation = annotation;

    NSLog(@"pav.frame.size = %@, pav.image.size = %@",
        NSStringFromCGSize(pav.frame.size),
        NSStringFromCGSize(pav.image.size));

    return pav;
}

10-08 07:47