Ios mkmarkerNotationView字形图像不';t显示
我正在尝试缩放一个大图像,以适合Ios mkmarkerNotationView字形图像不';t显示,ios,swift,mapkitannotation,Ios,Swift,Mapkitannotation,我正在尝试缩放一个大图像,以适合mkmarkernotationview子类的glyphimage: class MyAnnotationView: MKMarkerAnnotationView { var database = MyDatabase() override var annotation: MKAnnotation? { willSet { if let annotation = newValue as? MyAnnotat
mkmarkernotationview
子类的glyphimage:
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.")
}
}
}
}
}
}
当它运行时,我得到消息“find image”。但唯一显示的是标记注释内的白色矩形。我遗漏了什么?你必须隐藏其余部分:
self.glyphText = ""
self.glyphTintColor = UIColor.clear
self.markerTintColor = UIColor.clear
你能展示你正在使用的图像类型和它的框架吗?对于glyph图像,我认为它必须是一个模板图像类型的着色颜色,我认为它有大小要求。文件:()