Questions tagged [mkmapviewdelegate]

MKMapViewDelegate is a protocol that describes events originating from an MKMapView.

MKMapViewDelegate is a protocol that describes events originating from an MKMapView. Interested classes can get messages for changes to the map's annotations, overlays, visible region, and user location updates.

For more information, see the Apple Documentation for MKMapViewDelegate.

160 questions
2
votes
0 answers

Drawing a Custom Overlay on MKMapView with Core Graphics does not show on Map

I am working with iOS 7 and have extended an MKOverlayPathRenderer in order to draw custom overlays on an MKMap. I have implemented the following method of the MKOverlayPathRenderer class and the NSLog output shows that the code is called for…
totalcruise
  • 1,343
  • 2
  • 13
  • 25
2
votes
1 answer

MKAnnotionView does not show callout

I have made this implemention of MKAnnotionView: - (MKAnnotationView*) mapView:(MKMapView *)mapView viewForAnnotation:(id)annotation { if([annotation isKindOfClass:[MKUserLocation class]]) return nil; NSString…
Rasmus Styrk
  • 1,296
  • 2
  • 20
  • 36
2
votes
2 answers

Prevent MKMapViewDelegate methods from being called on device rotation

I am adding some functionality in - (void)mapView:(MKMapView *)mapView regionWillChangeAnimated:(BOOL)animated and - (void)mapView:(MKMapView *)mapView regionDidChangeAnimated:(BOOL)animated I want this to be called when the map region is…
Lollypop
  • 251
  • 1
  • 5
  • 14
2
votes
1 answer

MKMapView setRegion: animated: crashes the app (edited)

I have a MKMapView that expands (vertically) on tap (using UITapGestureRecognizer) and fires off an api call on pan (using UIPanGestureRecoginizer). Everything was working fine, until some time back, where on Panning, the app would crash, with…
Nitin Alabur
  • 5,812
  • 1
  • 34
  • 52
2
votes
3 answers

viewforoverlay never gets called

This is driving me nuts. I've been through all the posts on stackoveflow, but nothing fits the bill. I am trying to add a simple polyline (i.e. not a custom overlay) as an overlay to my MKMapView. The viewForOverlay method on the delegate never…
jdb1a1
  • 1,045
  • 1
  • 13
  • 32
1
vote
2 answers

My annotations doesn't show the Sub Title in the PIN

in the implementations class charged of displaying PINS, i have reserved two variables (title and sub title), in this example, only the word USA (the title) is displayed when i click on the PIN. CLLocationCoordinate2D location2D =…
Malloc
  • 15,434
  • 34
  • 105
  • 192
1
vote
3 answers

MKMapViewDelegate mapView:didUpdateUserLocation: method not called on iOS5

MKMapViewDelegate mapView:didUpdateUserLocation: method is not called when running on the 5.0 simulator, even if all location permissions are given in the device settings. With 4.3 it's working fine. Any ideas?
Gytis
  • 670
  • 6
  • 19
1
vote
2 answers

Adding over 14000 apple MapKit multipolyline overlays as MKOverlays crashes app

I am trying to add an array of multipolylines as MKOverlay to a map view as show in code below: import SwiftUI import MapKit struct PolylineMapView: UIViewRepresentable { func makeCoordinator() -> MapViewCoordinator{ return…
Heyman
  • 449
  • 4
  • 13
1
vote
1 answer

How to get the MKMapView instance from my UIViewRepresentable view?

I am using MapView this way (the code is of course simplified): struct IkMapView: UIViewRepresentable { var mapView = MKMapView() func makeUIView(context: Context) -> MKMapView { mapView.delegate = context.coordinator return mapView …
TigrouMeow
  • 3,669
  • 3
  • 27
  • 31
1
vote
0 answers

MKMapView has performance issue for clustering

I am trying to build a MKMapView to display the photos just as the Photos app in iOS as a practice. However, I see the following performance issue when building the application. When I am loading the annotations to the mapView, it looks like the…
1
vote
1 answer

Present context menu on MKAnnotationView

I want to be able to present a context menu when tapping on a MKAnnotationView directly, in addition to the callout accessory view. So for example, func mapView(_ mapView: MKMapView, didSelect view: MKAnnotationView) { let FirstAction =…
Peter Jacobs
  • 1,657
  • 2
  • 13
  • 29
1
vote
0 answers

How to detect user scrolling MKMapView

This delegate function fires whenever the map's content changes, regardless of whether it's changed in code or whether the user pans or zooms. optional func mapViewDidChangeVisibleRegion(_ mapView: MKMapView) Is it possible to detect when the user…
Ian Warburton
  • 15,170
  • 23
  • 107
  • 189
1
vote
1 answer

iOS MKMapKit regionDidChangeAnimated

I would like to determine the minimum + maximum visible latitude and longitude values in the MKMapViewDelegate delegate method: - (void)mapView:(MKMapView *)mapView regionDidChangeAnimated:(BOOL)animated A function like isCoordinateInRegion would…
user346443
  • 4,672
  • 15
  • 57
  • 80
1
vote
1 answer

Change MKMarkerAnnotationView size

How to change MKMarkerAnnotationView size? I tried to set annotationView.bounds.size = CGSize(width: 50, height: 50) but it does not look like the size has changed. I also tried to print out the size of the view and looks like it is defaulted to…
tuyen le
  • 305
  • 5
  • 11
1
vote
2 answers

MapView doesn't show Annotations after adding viewForAnnotations

so I am using MapKit for the first time and I am trying to show annotations with a callout. The annotations appear but as soon as I add the delegate function viewFor annotation (func mapView(_ mapView: MKMapView, viewFor annotation: MKAnnotation) ->…