图像而不是iPhone的MapKit框架中的默认引脚?

Chi*_*tel 6 iphone google-maps mapkit

是否有可能拥有我们自己的图像而不是iPhone上MapKit地图中的默认图钉?

我正在开发一个应用程序,它可以像谷歌纵横一样显示朋友的位置,并且需要在他们的位置显示朋友的图像.

可以使用JavaScript Google Map,但我想知道是否有人可以为基于MapKit的地图提供一些示例代码.

小智 14

对的,这是可能的.为此,你必须使用MKAnnotationView而不是MKPinAnnotationView.并且不要使用annotation.animatesDrop属性.

以下是您可以在viewForAnnotation中使用的示例代码,

    annotation = [[MKAnnotationView alloc] initWithAnnotation:annotation reuseIdentifier:@"try"];
    annotation.canShowCallout = YES;

    annotation.image = [UIImage imageNamed:@"image.png"];


    return annotation;
Run Code Online (Sandbox Code Playgroud)