问题描述
我有一个包含1397个注释的mapview,每个注释都有一个标注和“收藏夹”按钮。在移动地图,缩放等几分钟后,显示将变得缓慢。我一直在尝试调试xcode中的问题,并且似乎有一个对收藏夹按钮(在标注上)的强烈引用,当然,它是针对每个标注的(所以是1397次)。 这可能是个问题吗?如果是这样,我应该在代码的哪个位置将其更改为弱?谢谢
import Foundation
import MapKit
class StationMarkerView: MKMarkerAnnotationView {
override var annotation: MKAnnotation? {
willSet {
guard let station = newValue as? Station else {
return
}
canShowCallout = true
let mapsButton = FavouriteButton()
let bool = station.is_favourite
let image = bool! ? "star.fill": "star"
mapsButton.setBackgroundImage(UIImage(systemName: image),for: .normal)
rightCalloutAccessoryView = mapsButton
markerTintColor = station.markerTintColor
glyphImage = station.glyphImage
}
}
}
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)