[英]How to show current location and all annotation pin on map together iOS 8
[英]iOS how to keep current location center all the time
我的地圖顯示當前位置有藍點。當然,當我移動時,藍點移動..我只想保持地圖的藍點中心,使地圖移動而不是像谷歌地圖導航器..
我搜索了很多但找不到方法......
在地圖視圖委托中,執行以下操作:
- (void)mapView:(MKMapView *)mapView didUpdateUserLocation:(MKUserLocation *)userLocation
{
[mapView setCenterCoordinate:userLocation.location.coordinate animated:YES];
}
嘗試使用mapView.userTrackingMode = MKUserTrackingModeFollow;
,與手動使用位置管理器相比,您可以獲得更平滑的平移。
另外請注意,有一個現成的按鈕用於管理各種跟蹤狀態: MKUserTrackingBarButtonItem
。
最簡單的方法是在地圖視圖頂部創建一個帶有藍點的新UIView,並僅移動地圖的視圖。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.