iOS adding tapGesture to multiple Views

前端 未结 6 1039
无人及你
无人及你 2020-12-31 03:11

I have multiple views defined in my main view. I want to add single tap gesture to all these views. Below is the code I have written, but this registers a tap gesture to the

6条回答
  •  臣服心动
    2020-12-31 03:36

    1 use hitTest:

    CGPoint location = [singleTap locationInView:self.view];
    id testView = [self.view hitTest:location withEvent:nil];
    

    2 add THE Single TapGesture to multi views, only last view worked.

提交回复
热议问题