Google Maps GMSMaker iconView - iOS SDK

时间:2017-06-05 04:06:51

标签: ios swift xcode google-maps google-maps-api-3

错误:

  

GMSmarker类型的值没有成员iconView

如何使用iconView?

        let marker = GMSMarker()
        marker.position = CLLocationCoordinate2D(latitude: 13.7990609, longitude: 100.5494513)
        marker.title = "Coffee Factory"
        marker.snippet = "Chatuchak"
        marker.iconView = imageView
        marker.map = mapView

Value of type GMSmarker has no member iconView

3 个答案:

答案 0 :(得分:0)

确保您使用的是最新的Google Maps SDK v2.3.0及更高版本。

试试这个:

    marker.icon = UIImage(named: "<Your Image>")

编辑:

或者您可以将UIImageView设置为iconView

    marker.iconView = UIImageView(image: UIImage(named: "<Your Image>"))

输出:

Screen shot

希望它有所帮助。

答案 1 :(得分:0)

你可以尝试

   public struct ConnectionCheckResult
   {
       public bool Success;
       public string Message;
   }

答案 2 :(得分:0)

这就是我对此所做的事情。希望它也适合你。

Swift 3.0

let marker = GMSMarker()

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

let markerView = UIImageView(image: markerImage)

marker.position = CLLocationCoordinate2D(latitude: 33.5067, longitude: 51.2045)

marker.iconView = markerView
marker.map = mapView