【问题标题】:can I use Google maps and places in xcode, and can I customize the icons?我可以在 xcode 中使用谷歌地图和地点,我可以自定义图标吗?
【发布时间】:2019-10-24 14:12:08
【问题描述】:

我想在我的 IOS 应用程序上使用谷歌地图和地点。 甚至可能吗?如果是这样,我可以自定义谷歌地图中的图标吗?

【问题讨论】:

标签: swift xcode google-maps google-places-api


【解决方案1】:

您应该阅读并点击此链接进行集成: https://developers.google.com/maps/documentation/ios-sdk/start

对于自定义标记,请点击链接: google maps iOS SDK: custom icons to be used as markers

它是这样的:

let marker = GMSMarker()

// I have taken a pin image which is a custom image

let markerImage = UIImage(named: "mapMarker")!.withRenderingMode(.alwaysTemplate)

//creating a marker view

let markerView = UIImageView(image: markerImage)

//changing the tint color of the image

markerView.tintColor = UIColor.red

marker.position = CLLocationCoordinate2D(latitude: 28.7041, longitude: 77.1025)

marker.iconView = markerView
marker.title = "New Delhi"
marker.snippet = "India"
marker.map = mapView

//comment this line if you don't wish to put a callout bubble
mapView.selectedMarker = marker

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2014-05-22
    • 1970-01-01
    • 2021-04-26
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-07-25
    相关资源
    最近更新 更多