Guest User

Untitled

a guest
Jul 11th, 2018
94
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.34 KB | None | 0 0
  1. [mapView removeAnnotations:mapView.annotations]
  2.  
  3. mapView.showUserLocation = YES
  4.  
  5. - (MKAnnotationView *)mapView:(MKMapView *)theMapView viewForAnnotation:(id<MKAnnotation>)annotation
  6.  
  7. MKPinAnnotationView* annView = (MKPinAnnotationView *)[mapView dequeueReusableAnnotationViewWithIdentifier:@"currentloc"];
  8.  
  9. if (!annView) {
  10. MKPinAnnotationView *annView=[[MKPinAnnotationView alloc] initWithAnnotation:annotation reuseIdentifier:@"currentloc"];
  11. annView.pinColor = MKPinAnnotationColorRed;
  12. annView.animatesDrop=TRUE;
  13. annView.canShowCallout = YES;
  14. annView.calloutOffset = CGPointMake(-5, 5);
  15. if ([annotation isKindOfClass:[DraggableAnnotationAM class]] ) annView.draggable =YES;
  16. return annView;
  17.  
  18. }
  19. else {
  20. if ([annotation isKindOfClass:[DraggableAnnotationAM class]] ) annView.draggable = YES;
  21. annView.annotation = annotation;
  22. return annView;
  23. }
  24.  
  25. MKUserLocationView
  26.  
  27. NSMutableArray *annotation = [[NSMutableArray alloc] init];
  28. for (id <MKAnnotation> annot_ in [mapView annotations])
  29. {
  30. if ( [annot_ isKindOfClass:[ MKUserLocation class]] ) {
  31. }
  32. else {
  33. [annotation addObject:annot_];
  34.  
  35.  
  36. }
  37. }
  38.  
  39. [mapView removeAnnotations:annotation];
  40.  
  41. [annotation release];
  42.  
  43. annotation = nil;
Add Comment
Please, Sign In to add comment