如何显示所有带有标题和图像的地图图钉?

问题描述

我为地图视图上的图钉提供了自定义图像,单击时会显示标题代码如下;

   func mapView(_ mapView: MKMapView,viewFor annotation: MKAnnotation) -> MKAnnotationView? 
     {
    let reuseId = "Pin"
    var pinView = mapView.dequeueReusableAnnotationView(withIdentifier: reuseId)
    pinView = MKAnnotationView(annotation: annotation,reuseIdentifier: reuseId)
    pinView?.image = UIImage(named: "map_pin")
    pinView!.canShowCallout = true;
    pinView?.setSelected(true,animated: true)
    
    return pinView
}

但是,如果我删除上面的代码并说 mapView.showAnnotations (annotations,animation: true) 所有标题都可见,但我不能放置自定义图像,我想在图钉下显示标题。 我怎样才能做到这两点?我希望标题自定义图片显示标题下方。

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)