我很難弄清楚當用戶點擊指向當前位置的註釋時如何顯示註釋標題。除此之外,一切工作都很好。我使用的CLLocationManager
https://github.com/varshylmobile/LocationManager包裝,但我不認爲它影響Mapbox
,因爲我可以在地圖上正確顯示我的引腳。Mapbox iOS SDK 3 - 註釋標題在註釋被點擊時不顯示
這裏的截圖樣本:
正如你所看到的,我可以運行沒有任何問題的應用程序。只是當我將一些註釋標題和副標題設置到引腳上,並在運行時點擊它時,它不會顯示任何內容。
這裏是我的註釋代碼片段:
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)
,這裏是呼出功能:
func mapView(mapView: MGLMapView, annotationCanShowCallout annotation: MGLAnnotation) -> Bool {
return true
}
func mapView(mapView: MGLMapView, imageForAnnotation annotation: MGLAnnotation) -> MGLAnnotationImage? {
return nil
}
我在iOS 9.2時,Xcode 7
謝謝!
我有此相同的問題!謝謝! – SMPLGRP