1

我刚刚将自定义图钉图像添加到地图上的图钉。问题是图钉非常大并且覆盖了很多地图,放大后可以很好地放大,但缩小时会出现问题,因为用户看不到任何地图。

当用户缩小时,如何使图钉缩小?我用谷歌搜索了它,但似乎找不到任何答案。

这是我的代码

有谁知道如何做到这一点或我在哪里可以找到如何?

谢谢!

4

2 回答 2

2

来自“位置感知编程指南”:

无论地图的当前缩放级别如何,每次都以相同的比例绘制所有注释。

您需要跟踪地图的缩放级别并更改注释的图像大小。希望,这会有所帮助:http ://troybrant.net/blog/2010/01/set-the-zoom-level-of-an-mkmapview/

于 2012-10-15T19:17:54.077 回答
1

You should review one or two tutorials on using mapkit to see how it's done. A map pin implemented as an MKMapAnnotationView will always scale properly (it will always stay the same size while the map scale changes.

Try looking over this tutorial by Ray Wenderlich. There is a lot to digest, but the main points to refer to are how to use the MKAnnotation protocol (see the MyLocation class in this tutorial), how pins are actually added as "annotations" (see the - (void)plotCrimePositions:(NSString *)responseString method), and, finally, how the MKMapViewDelegate methods are used, particularly - (MKAnnotationView *)mapView:(MKMapView *)mapView viewForAnnotation:(id <MKAnnotation>)annotation.

于 2012-10-15T19:34:55.573 回答