Advertisement
Guest User

Untitled

a guest
Apr 23rd, 2014
30
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.76 KB | None | 0 0
  1. CLLocationCoordinate2D center;
  2. center.latitude = latitude;
  3. center.longitude = longitude;
  4.  
  5. CLLocationCoordinate2D location = mapView.userLocation.coordinate;
  6. MKCoordinateRegion region;
  7. MKCoordinateSpan span;
  8.  
  9. location.latitude = center.latitude; //37.250556;
  10. location.longitude = center.longitude; //-96.358333;
  11.  
  12. span.latitudeDelta = 0.05;
  13. span.longitudeDelta = 0.05;
  14.  
  15. region.span = span;
  16. region.center = location;
  17.  
  18. [mapView setRegion:region animated:YES];
  19. [mapView regionThatFits:region];
  20.  
  21. // Add the annotation to our map view
  22. MapViewAnnotation *newAnnotation = [[MapViewAnnotation alloc] initWithTitle:@"Buckingham Palace" andCoordinate:location];
  23. [self.mapView addAnnotation:newAnnotation];
  24. [newAnnotation release];
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement