vip*_*pul 18 iphone mkmapview ios
我通过使用启用来显示current locationin .我还希望将用户当前位置以及位置的缩放地图居中.请帮我解决这个问题,因为我在stackoverflow上没有得到任何其他类似问题的帮助.MKMapViewshowUserLocationmapview
我的代码如下:
- (void)viewDidLoad {
[super viewDidLoad];
[mapView setMapType:MKMapTypeStandard];
[mapView setZoomEnabled:YES];
[mapView setScrollEnabled:YES];
[mapView setCenterCoordinate:mapView.userLocation.location.coordinate animated:YES];
[mapView setDelegate:self];
}
Run Code Online (Sandbox Code Playgroud)
Den*_*nis 51
要以用户位置为中心,您可以使用以下代码:
[mapView setCenterCoordinate:mapView.userLocation.location.coordinate animated:YES];
Run Code Online (Sandbox Code Playgroud)
要放大特殊位置,您应该研究区域(MKCoordinateRegion)的计数和工作方式,计算区域的值并使用调用显示它:
[mapView setRegion:myRegion animated:YES];
Run Code Online (Sandbox Code Playgroud)
此示例WorldCities显示了区域显示的基础知识.
| 归档时间: |
|
| 查看次数: |
31896 次 |
| 最近记录: |