我正在尝试缩放大图像以适合MKMarkerAnnotationView
子类的字形图像:
class MyAnnotationView: MKMarkerAnnotationView {
var database = MyDatabase()
override var annotation: MKAnnotation? {
willSet {
if let annotation = newValue as? MyAnnotation {
canShowCallout = true
markerTintColor = annotation.markerTintColor
if let pic = annotation.pic {
if let image = database.picImage(pic: pic) {
print("Found image.")
self.contentMode = .scaleAspectFit
self.glyphImage = image
} else {
print("Didn't find image.")
}
}
}
}
}
}
当它运行时,我收到消息“找到图像”。但唯一显示的是标记注释内的白色矩形。我想念什么?
答案 0 :(得分:0)
您必须隐藏其余部分:
self.glyphText = ""
self.glyphTintColor = UIColor.clear
self.markerTintColor = UIColor.clear