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。有没有人遇到过这个问题?谢谢!