Reputation: 997
I want to show custom marker view on my map. I got reference from : https://stackoverflow.com/a/16767124/2849443
var pin:GMSMarker = GMSMarker(position: CLLocationCoordinate2DMake(currentLocation.coordinate.latitude, currentLocation.coordinate.longitude))
pin.infoWindowAnchor = CGPointMake(0.0, 0.0)
pin.icon = UIImage(named: "img_map_pin")
pin.map = mapView?
mapView?.selectedMarker = pin
My method for custom view marker is as shown below
func mapView(mapView: GMSMapView!, markerInfoWindow marker: GMSMarker!) -> UIView! {
var arr:NSArray = NSBundle.mainBundle().loadNibNamed("MarkerView", owner: self, options: nil)
var view:MarkerView = arr[0] as MarkerView
view.IBlblAddress?.text = "text"
return view
}
I have set delegate GMSMapViewDelegate and also mapView.delegate = self is set , still my method is not getting called. What could be the issue?
Upvotes: 0
Views: 4945
Reputation: 1595
var marker = GMSMarker()
marker.position = CLLocationCoordinate2DMake(41.887, -87.622)//here you can give your current lat and long
marker.appearAnimation = kGMSMarkerAnimationPop
marker.icon = UIImage(named: "flag_icon")
marker.map = mapView
self.view = mapView
https://developers.google.com/maps/documentation/ios/
Upvotes: 1