使用自定义图像时 MKAnnotationView 不显示标题

问题描述

我已按照 here 中的指南在地图上显示自定义注释。

但是,我只能以失去注释标题的代价来自定义图像。在以下代码中,取自 MapDelegate 的 GetViewForAnnotation,设置自定义图像不仅仅是为了确认将显示标题

MapKit.MKAnnotationView vehicleView = (MapKit.MKAnnotationView)mapView.DequeueReusableAnnotation(mKPointAnnotation.Subtitle.GetHashCode().ToString());
if (vehicleView == null)
{
    vehicleView = new MapKit.MKAnnotationView(annotation,mKPointAnnotation.Subtitle.GetHashCode().ToString());

    byte[] encodedDataAsBytes = Convert.FromBase64String(mKPointAnnotation.Subtitle);
    NSData data = NSData.FromArray(encodedDataAsBytes);
    var uiImage = UIImage.LoadFromData(data);

    vehicleView.CanShowCallout = true;

    //vehicleView.Image = uiImage;

    vehicleView.Layer.ZPosition = 7;

}

return vehicleView;

让我们看看结果:

没有自定义图片,我们有标题

enter image description here

使用自定义图片,我失去了标题

enter image description here

我该怎么办?

解决方法

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

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

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