gpt4 book ai didi

ios - MKMarkerAnnotationView 字形图像不显示

转载 作者:行者123 更新时间:2023-11-30 11:19:04 25 4
gpt4 key购买 nike

我正在尝试缩放大图像以适合 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.")
}
}
}
}
}
}

当它运行时,我收到消息“找到图像”。但唯一显示的是标记注释内的白色矩形。我错过了什么?

最佳答案

你必须隐藏其余部分:

self.glyphText = ""
self.glyphTintColor = UIColor.clear
self.markerTintColor = UIColor.clear

关于ios - MKMarkerAnnotationView 字形图像不显示,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51487292/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com