自定义地图注释模糊

Custom Map Annotation is blurry

您好,我在 Sketch 3 中创建了一个自定义注释,当我将其缩小以适应地图视图时,它变得模糊。我该如何解决这个问题?

您可以尝试将节点纹理的过滤模式设置为.Nearest

 let nodeTexture = SKTexture(imageNamed: "node")
 nodeTexture.filteringMode = .Nearest
 node = SKSpriteNode(texture: nodeTexture)

我也遇到了这个问题。也许这可能会帮助其他人,因为您似乎已经找到了合适的解决方案。

func mapView(mapView: MKMapView, viewForAnnotation annotation: MKAnnotation) -> MKAnnotationView? {
    let reuseId = "id"
    var anView = mapView.dequeueReusableAnnotationViewWithIdentifier(reuseId)
    if anView == nil {
        anView = MKAnnotationView(annotation: annotation, reuseIdentifier: reuseId)
        anView!.canShowCallout = true
    }
    else {
        anView!.annotation = annotation
    }

    anView!.image = yourFullSizeImage
    anView!.frame.size = CGSize(width: 50, height: 50) //Resize frame AFTER setting image, for me resizing frame first did not work

    return anView
}