【问题标题】:Custom Map Annotation is blurry自定义地图注释模糊
【发布时间】:2015-08-11 21:32:21
【问题描述】:

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

【问题讨论】:

    标签: swift mapkitannotation sketch-3


    【解决方案1】:

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

    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
    }
    

    【讨论】:

    • 是的,我不得不使用 makeappicon.com 来缩小我的图像。这是我能做到的唯一方法
    【解决方案2】:

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

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

    【讨论】:

    • SKTexture 和 SKSpriteNode 没有出现在我面前。我需要导入任何框架吗?
    • 完全忘记了,你需要使用 spritekit
    • 我无法从您的代码中得到什么,但我决定继续访问 www.makeappicon.com,并且能够使用它为 Apple Watch 制作的缩小图标现在图像质量非常好。感谢您的帮助
    猜你喜欢
    • 1970-01-01
    • 2021-02-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多