开发者

MKPinAnnotationView: Pin width and height

开发者 https://www.devze.com 2023-03-28 15:48 出处:网络
What is the width and the height of the MKPinAnnotationView pin in pixels? Edit: To be more concret开发者_运维技巧e, the width and height of imaginary rectangle on iPhone screen containing the pin. A

What is the width and the height of the MKPinAnnotationView pin in pixels?

Edit: To be more concret开发者_运维技巧e, the width and height of imaginary rectangle on iPhone screen containing the pin.


According to the code below, the pin image and the MKPinAnnotationView are both 32 points wide and 39 points high:

- (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;
}
0

精彩评论

暂无评论...
验证码 换一张
取 消