xcode - Mapbox iOS SDK 3 - annotation title not showing when annotation is tapped -
i'm having hard time figuring out how make annotation title appear when user tapped annotation pointed current location. working fine except this. using cllocationmanager
wrapper https://github.com/varshylmobile/locationmanager don't think it's affecting mapbox
since can display pins correctly on map.
here's screenshot sample:
as can see, run app without problems. it's when set annotation title , subtitle pin, , tapped @ run-time, doesn't show anything.
here's code snippet annotation:
let point = mglpointannotation() point.coordinate = cllocationcoordinate2d(latitude: location.coordinate.latitude, longitude: location.coordinate.longitude) point.title = "hello world!" point.subtitle = "welcome 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 ellipse." self.mapview.addannotation(point2) self.mapview.selectannotation(point, animated: true) self.mapview.showannotations([point, point2], animated: true)
and here call out function:
func mapview(mapview: mglmapview, annotationcanshowcallout annotation: mglannotation) -> bool { return true } func mapview(mapview: mglmapview, imageforannotation annotation: mglannotation) -> mglannotationimage? { return nil }
i on ios 9.2, xcode 7.
thank you!
i forgot line of code after instantiating map view.
mapview.delegate = self
thanks!
Comments
Post a Comment