Hi!
Here comes another question related to the KMLViewer MapKit example:
My KML file contains 11 annotations in the form of MKPointAnnotation.
Each of them contain a text, which can be found in '_title', in the Xcode debugger. But it is not displayed on the map (MKMapView).
Can any one help me figure out why?
Thank you!
The KMLViewer can be found here:
https://github.com/ooper-shlab/KMLViewer-Swift
It can be imported directly in Xcode.
Here comes another question related to the KMLViewer MapKit example:
My KML file contains 11 annotations in the form of MKPointAnnotation.
Each of them contain a text, which can be found in '_title', in the Xcode debugger. But it is not displayed on the map (MKMapView).
Can any one help me figure out why?
Thank you!
The KMLViewer can be found here:
https://github.com/ooper-shlab/KMLViewer-Swift
It can be imported directly in Xcode.
As far as I tried KMLViewer with your kml shown in another thread of yours,Can any one help me figure out why?
the title was shown in the callout when I tapped the pin.
I think this is the usual behavior of MKPinAnnotationView.
If you want to show the title sort of permanently, you may need to use another annotation view class.
For example:
Code Block var annotationView: MKAnnotationView? { if _annotationView == nil { if let annotation = self.point { if #available(iOS 11.0, *) { let marker = MKMarkerAnnotationView(annotation: annotation, reuseIdentifier: nil) _annotationView = marker } else { // Fallback on earlier versions let pin = MKPinAnnotationView(annotation: annotation, reuseIdentifier: nil) pin.canShowCallout = true pin.animatesDrop = true _annotationView = pin } } } return _annotationView }
Or else, if you do not prefer any of the predefined annotation view classs, you can create your own custom class by subclassing MKAnnotationView.