Mapkit批注图像分辨率

问题描述 投票:0回答:1

我已将注释图钉更改为自定义图片,效果很好。但是,当图像在地图视图中掉落时,其边缘看起来有些粗糙。有谁知道如何锐化图像?

谢谢。

iphone image annotations mapkit
1个回答
0
投票

我有同样的问题,并通过使用UIGraphicsImageRenderer创建图像来解决。现在它们很锋利。

let whiteImage = UIImage(named: "white")

let size = CGSize(width: 60, height: 60)

  let myImage = UIGraphicsImageRenderer(size: size).image { imageContext in
      let context = imageContext.cgContext
      whiteImage?.draw(in: CGRect(origin: .zero, size: CGSize(width: 70, height: 90)))
  }

annotationView!.image = myImage
© www.soinside.com 2019 - 2024. All rights reserved.