0
嘿,我一直在尋找這個答案,但似乎無法找到任何哈哈。所以我在看的是添加一個UIWebView MKPinAnnotationView.detailCalloutAccessoryView,以便我可以使用HTML來做一些格式。但它不能正常工作。看到我的代碼如下。添加UIWebView MKPinAnnotationView.detailCalloutAccessoryView
view = MKPinAnnotationView(annotation: annotation, reuseIdentifier: identifier)
view.canShowCallout = true
view.calloutOffset = CGPoint(x: -5, y: 5)
let detailView = UIWebView()
let poi = annotation as POI
var htmlString: String = "<html><body><p>"
htmlString = htmlString + "<b><font size = \"3\">" + poi.title! + "</font></b><br>"
htmlString = htmlString + "Number of Reviews: " + String(poi.review_count) + "<br>"
htmlString = htmlString + "</p></body></html>"
detailView.loadHTMLString(htmlString, baseURL: nil)
view.detailCalloutAccessoryView = detailView
我得到的結果是這樣的。
只有標題顯示出來,這也是我認爲來自MKAnnotation.title,而不是我的UIWebView。有沒有人遇到過這個問題?謝謝!