tap gesture recognizer - which object was tapped?

前端 未结 12 1324
萌比男神i
萌比男神i 2020-12-29 17:47

I\'m new to gesture recognizers so maybe this question sounds silly: I\'m assigning tap gesture recognizers to a bunch of UIViews. In the method is it possible to find out w

12条回答
  •  误落风尘
    2020-12-29 18:31

    you can use

     - (void)highlightLetter:(UITapGestureRecognizer*)sender {
         UIView *view = sender.view; 
         NSLog(@"%d", view.tag); 
    }
    

    view will be the Object in which the tap gesture was recognised

提交回复
热议问题