0

I've a dynamic TableView, in every cell there's a MKMapView. I need that, when user tap the map (exclusively the map), app displays a new controller with expanded map.

I started placing an UITapGestureRecognizer on the map but I discovered that, from iOS 9 it doesn't works, so I followed this https://stackoverflow.com/a/35377200/2085352 and it works fine; trouble is that I can't find a way to detect from which cell does UITapGestureRecognizer come from.

I tried assigning a tag to every UITapGestureRecognizer but seems not possible, so what can I do?

Community
  • 1
  • 1
Matte.Car
  • 2,007
  • 4
  • 23
  • 41

1 Answers1

1

If you are using the solution you liked to, you can determine the cell from the UITapGestureRecognizer passed into the function in step 4:

func imgFaild_Click(sender: UITapGestureRecognizer) {
   let location = sender.locationInView(self.tableView)
   let indexPath = self.tableView.indexPathForRowAtPoint(location)
   //do something with the indexPath
 }
beyowulf
  • 15,101
  • 2
  • 34
  • 40