3

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

4

2 回答 2

3

我也遇到了麻烦。也许这可能对其他人有所帮助,因为您似乎已经找到了合适的解决方案。

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
}
于 2016-08-09T09:51:45.450 回答
2

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

 let nodeTexture = SKTexture(imageNamed: "node")
 nodeTexture.filteringMode = .Nearest
 node = SKSpriteNode(texture: nodeTexture)
于 2015-08-11T22:53:58.413 回答