Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我有这个代码..
-(IBAction)getlocation { mapview.showsUserLocation = YES; [mapview setCenterCoordinate:mapview.userLocation.coordinate animated:YES];
而且我还有一个固定坐标的图钉。我想要的是当按下用户定位按钮时,我希望视图从图钉缩小,然后移动并放大回用户位置。我当前的代码只是前往当前位置。我如何从大头针缩小,然后旅行,最后放大?先感谢您..
尝试这个:
[_mapView setCenterCoordinate:pinCoordinate zoomLevel:minZoomValue animated:YES];
(应该从图钉缩小地图)
然后调用:
mapview.showsUserLocation = YES; [mapview setCenterCoordinate:mapview.userLocation.coordinate animated:YES];
将地图缩放到用户的坐标。(可选地,您可以设置所需的缩放级别,如上所示)