I am trying to find a way to do a zoom in and out via a button. If I put code within the method didAddAnnotationViews
, it will set the initial zoom perfectly. I tried to get the zoom to change with the code below, but it keeps on crashing saying:
Unrecognized Selector sent to Instance
How can I run this in an IBAction?
-(IBAction)ZoomIn:(MKCoordinateSpan)coordinateSpanWithMapView:(MKMapView *)mv centerCoordinate:(CLLocationCoordinate2D)location
{
MKCoordinateRegion region;
MKCoordinateSpan span;
span.latitudeDelta=0.05;
span.longitudeDelta=0.05;
location = mv.userLocation.coordinate;
location = mv.userLocation.location.coordinate;
region.span=span;
region.center=location;
[mv setRegion:region animated:TRUE];
[mv regionThatFits:region];
};