I have a question about map and delegate. I am doing a exercise from a book and it says to me to use the method
- (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];
}
Which means every time I move my phone from my location it will show myself on screen. I also create a button that calls this method. Therefore if I am scrolling my map I can see where I am.
The problem is: if I am in a car and want to scroll my map it will become a difficult task due this method will be call all the time I change my location.
Is there any other method or if I have an option to activate and deactivate a delegate?
Thanks in advance.
As far as I can tell it’s quite simple. Just have a button for activating and deactivating it.
The property:
The button action:
You don’t have to make it any harder than that.