Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- - (void)zoomInGesture:(UITapGestureRecognizer *) recognizer {
- currentRegion = self.mapView.region;
- currentSpan = self.mapView.region.span;
- isZoomingWithDoubleTap = YES;
- MKCoordinateRegion region = currentRegion;
- MKCoordinateSpan span = currentSpan;
- span.latitudeDelta = currentSpan.latitudeDelta / 2.3;
- span.longitudeDelta = currentSpan.longitudeDelta / 2.3;
- region.span = span;
- [self.mapView setRegion:region animated:YES];
- }
- - (void)pinchOnMap:(UIPinchGestureRecognizer *) recognizer {
- if (self.mapView.region.span.latitudeDelta < 0.18) {
- if (recognizer.state == UIGestureRecognizerStateBegan) {
- currentRegion = self.mapView.region;
- currentSpan = self.mapView.region.span;
- }
- if (recognizer.state == UIGestureRecognizerStateChanged) {
- MKCoordinateRegion region = currentRegion;
- MKCoordinateSpan span = currentSpan;
- span.latitudeDelta = currentSpan.latitudeDelta / recognizer.scale;
- span.longitudeDelta = currentSpan.longitudeDelta / recognizer.scale;
- region.span = span;
- [self.mapView setRegion:region animated:NO];
- }
- }
- else {
- CLLocationCoordinate2D coordinate = [self.mapView.userLocation coordinate];
- MKCoordinateRegion region;
- region.center = coordinate;
- MKCoordinateSpan span;
- span.latitudeDelta = 0.1;
- span.longitudeDelta = 0.1;
- region.span = span;
- [self.mapView setRegion:region animated:YES];
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement