簡體   English   中英

MapView注解

[英]MapView annotation

我已經在注釋視圖中添加圖像,當我撫摸注釋查看其照片量變到質變為紅腳任何一個可以告訴我什么是他的原因吧

- (MKAnnotationView *)mapView:(MKMapView *)mapView viewForAnnotation:(id <MKAnnotation>)annotation 
{
    MKPinAnnotationView* newAnnotation = [[MKPinAnnotationView alloc] initWithAnnotation:annotation reuseIdentifier:@"annotation1"];

    if (annotation == _mapView.userLocation)
    {
        newAnnotation.rightCalloutAccessoryView = [UIButton buttonWithType:UIButtonTypeDetailDisclosure];
        return nil;
    }

    //[newAnnotation setSelected:YES];
    newAnnotation.image = [UIImage imageNamed:@"sample.png"];
    newAnnotation.rightCalloutAccessoryView = [UIButton buttonWithType:UIButtonTypeDetailDisclosure];
    newAnnotation.canShowCallout = YES;
    [newAnnotation retain];

    return newAnnotation;

}

使newAnnotation一個MKAnnotationView而非MKPinAnnotationView

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM