-2

I want to know the container of an UITapGestureRecognizer in Swift

For example, if I put a UITapGestureRecognizer in View1

When UITapGestureRecognizer action is triggered, how do I know that View1 is the container of that UITapGestureRecognizer?

Schemetrical
  • 5,506
  • 2
  • 26
  • 43
Daud 11
  • 189
  • 1
  • 2
  • 7
  • 1
    The UIGestureRecognizer docs are here: https://developer.apple.com/library/ios/documentation/UIKit/Reference/UIGestureRecognizer_Class/#//apple_ref/occ/instp/UIGestureRecognizer/view Notice it says "view: The view the gesture recognizer is attached to." Gosh, what might that be about? – matt Apr 08 '15 at 15:54

1 Answers1

0

Inside your selector that you pass for the UITapGestureRecognizer to call, sender will be the gestureRecognizer, and sender.view will be the view the UITapGestureRecognizer is attached to.

Schemetrical
  • 5,506
  • 2
  • 26
  • 43