如何在MKMapView中调整自定义注释图钉图像的大小? [英] How to resize the custom annotation pin image in MKMapView?

查看:81
本文介绍了如何在MKMapView中调整自定义注释图钉图像的大小?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用swift4.我添加了带有一些图钉的MKMapView,但是我需要根据地图缩放来调整图钉图像的大小.

I am using swift 4. I have added MKMapView with some pins but I need to resize the pin image based on the map zooming.

因此,如果有人知道,如何根据地图缩放来调整图像大小?

So if anyone knows, how to resize the image based on map zooming?

推荐答案

您不能.当用户缩放地图时,大头针总是说出恒定的大小.

You can't. Pins always say a constant size as the user zooms the map.

您将要研究使用MKOverlay以及可能的自定义MKOverlayRenderer子类.这样一来,您就可以绘制随用户放大和缩小而增长和缩小的内容.

You'll want to look into using a MKOverlay and possibly a custom MKOverlayRenderer subclass. That will allow you to draw content that grows and shrinks as the user zooms in and out.

这篇关于如何在MKMapView中调整自定义注释图钉图像的大小?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆