我需要在iOS应用程序中的Google Maps屏幕上创建一个
在此标记内部,我需要适应用户的图像。我已经将这两个图像放在我的资源中。
我尝试过:
GMSMarker
。我需要将标记设置为图像组合,即通用标记图像和用户图像的组合。
例如:![Generic marker](https://istack.dev59.com/j3ymL.webp)
func image(byDrawingImage image: UIImage, inRect rect: CGRect) -> UIImage! {
UIGraphicsBeginImageContext(size)
draw(in: CGRect(x: 0, y: 0, width: size.width, height: size.height))
image.draw(in: rect)
let result = UIGraphicsGetImageFromCurrentImageContext()
UIGraphicsEndImageContext()
return result
}
但是这返回的图像不完美。 有其他解决方案吗? 注意:这里提供的示例标记图像并非我实际使用的那个。那是一个矩形标记。