首页 > 解决方案 > 如何向图层添加个性化注释?地图盒 [斯威夫特]

问题描述

如何向图层添加个性化注释?

我的自定义类:

class PointCustom: NSObject, MGLAnnotation {
    var coordinate: CLLocationCoordinate2D
    var title: String?
    var subtitle: String?
    var imageURL: URL?
    var typ: PointsType?

    var reuseIdentifier: String?

    init(coordinate: CLLocationCoordinate2D, title: String?, subtitle: String?, imageURL: URL?, reuseIdentifier: String?, typ: PointsType?) {
        self.coordinate = coordinate
        self.title = title
        self.subtitle = subtitle
        self.imageURL = imageURL
        self.reuseIdentifier = reuseIdentifier
        self.typ = typ
    }
}


let points = parsePoints()
let source = MGLShapeSource(identifier: "points", features: points, options: nil)

问题:无法将类型“[PointCustom]”的值转换为预期的参数类型“MGLShape?”

标签: iosswiftxcodemapbox

解决方案


推荐阅读