0
我有一個關於地圖和委託的問題。我做一本書一個鍛鍊和它說,我使用的方法MKMapKit iOS 5.我可以在需要時設置所需的委託嗎?
- (void)mapView:(MKMapView *)mapView didUpdateUserLocation:(MKUserLocation *)userLocation
{
//CLLocationCoordinate2D loc = [userLocation coordinate];
self.coord2D = [userLocation coordinate];
//MKCoordinateRegion region = MKCoordinateRegionMakeWithDistance(loc, 250, 250);
MKCoordinateRegion region = MKCoordinateRegionMakeWithDistance(self.coord2D, 250, 250);
[worldView setRegion:region animated:YES];
}
這意味着每次我提出我的電話從我的位置時,它會顯示自己在屏幕上。我還創建了一個調用此方法的按鈕。因此,如果我滾動我的地圖,我可以看到我在哪裏。
問題是:如果我在一輛汽車上並想滾動我的地圖,這將變成一項艱鉅的任務,因爲此方法將在我改變我的位置時隨時致電。
有沒有其他的方法,或者如果我有一個選項來激活和停用委託?
在此先感謝。
什麼是簡單的解決方案。非常感謝 – Camus