问题描述
我正在开发iPhone应用程序,需要在其中显示特定纬度和图像的图像.在地图上的经度.要求是-即使用户在此地图屏幕上放大或缩小,地图控件也应在缩放后自动居中到同一纬度和纬度.长.我正在使用MKMapView.
I am developing an iPhone application in which I need to show an image at a specific Latitude & Longitude on a Map. The requirement is - Even if the user zooms in or out on this map screen, the map control should automatically center itself after the zoom, to the same Lat & Long. I am using MKMapView.
我试图浏览所有可用的文档.但是,我无法碰到任何回调或其他方法来实现目标.
I have tried to go through all available documentation. However, I could not come across any callback or other method that will allow me to achieve the objective.
一种选择是处理触摸事件.但是,我发现这是一个非常复杂的解决方案.我希望有一个更简单的替代方案.以上有什么想法吗?
One alternative is to handle touch events. However, I find that as a very complicated solution. And I hope that a simpler alternative exists. Any ideas on the above?
可以帮忙吗?任何示例将不胜感激.
Can you please help? Any example will be appreciated.
推荐答案
实施MKMapViewDelegate
,然后尝试以下操作:
Implement MKMapViewDelegate
and then try this:
- (void)mapView:(MKMapView *)mapView regionDidChangeAnimated:(BOOL)animated {
[mapView setCenterCoordinate:locationManager.coordinate animated:NO];
}
用CLLocationManager
的名称替换locationManager
.
这篇关于如何使用MKMapView放大/缩小iPhone应用程序中的最新地图的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!