I'm having a hard time figuring out how to make the annotation title appear when a user tapped an annotation pointed to the current location. Everything is working fine except this. I am using CLLocationManager wrapper from https://github.com/varshylmobile/LocationManager but I don't think it's affecting the Mapbox since I can display my pins correctly on the map.
Here's the screenshot sample:
As you can see, I could run the app without any problems. It's just when I set some annotation title and subtitle to the pin, and tapped it at run-time, it doesn't show anything.
Here's my code snippet for the annotation:
let point = MGLPointAnnotation()
point.coordinate = CLLocationCoordinate2D(latitude: location.coordinate.latitude, longitude: location.coordinate.longitude)
point.title = "Hello world!"
point.subtitle = "Welcome to The Ellipse."
self.mapView.addAnnotation(point)
let point2 = MGLPointAnnotation()
point2.coordinate = CLLocationCoordinate2D(latitude: 37.43259552, longitude: location.coordinate.longitude)
point2.title = "Hello world!"
point2.subtitle = "Welcome to The Ellipse."
self.mapView.addAnnotation(point2)
self.mapView.selectAnnotation(point, animated: true)
self.mapView.showAnnotations([point, point2], animated: true)
and here is the call out function:
func mapView(mapView: MGLMapView, annotationCanShowCallout annotation: MGLAnnotation) -> Bool {
return true
}
func mapView(mapView: MGLMapView, imageForAnnotation annotation: MGLAnnotation) -> MGLAnnotationImage? {
return nil
}
I am on iOS 9.2, xCode 7.
Thank you!
