Can Sürmeli Can Sürmeli - 1 year ago 110
Swift Question

Show GMSPolyline Title On Tap

I'm using Google Maps SDK for an iOS application of mine.

I configured it so that when a tap occurs on a

, it shows it's title. It's working alright.

I want to do the same for
s but couldn't figure out how. The lines's
property is set to

How can I achieve this. Thanks.

P.S. coding with Swift 2.0


Conform to the protocol GMSMapViewDelegate:

class ViewController: UIViewController, GMSMapViewDelegate {

Set the ViewController to be the delegate of your map view:

override func viewDidLoad() {
  viewMap.delegate = self

Use the method mapView:didTapOverlay:

func mapView(mapView: GMSMapView, didTapOverlay overlay: GMSOverlay) {

This method is called whenever a tap is detected inside the map view.

For more information: GMSOverlay