Pav*_*nen 1 annotations center mkmapview ios
现在,当我选择注释时,我将视图重新定位为居中,如下所示:
[mapView setCenterCoordinate:view.annotation.coordinate animated:YES];
Run Code Online (Sandbox Code Playgroud)
但是,如何才能将视图重新定位到垂直而不是水平居中?
创建一个具有注释和当前经度纬度的新坐标
CLLocationCoordinate2D newCenter = CLLocationCoordinate2DMake(view.annotation.coordinate.latitude, mapView.centerCoordinate.longitude);
Run Code Online (Sandbox Code Playgroud)
像以前一样设置它
[mapView setCenterCoordinate:newCenter animated:YES];
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
1755 次 |
| 最近记录: |