【发布时间】:2017-03-09 15:16:03
【问题描述】:
我需要在 iOS 应用中为我的 Google 地图屏幕创建一个GMSMarker。我需要标记是图像的组合,即通用标记图像和用户图像。
例如:
在这个标记内,我需要适应用户的图像。我的资产中都有这两个图像。 试过了
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
}
但这返回了一个不完美的图像。 有替代解决方案吗? 注意:此处提供的示例标记图像不是我实际使用的。那是一个矩形标记。
【问题讨论】:
标签: ios swift google-maps