1

I have a custom UIControl element, a picker with little scroller. I want to hide it when I tap outside it. I have tried adding UITapGestureRecognizer to self.view but it fails, as there are many subviews (complex UICollectionView cells) and they intercept this recognizer.

I want the recognizer to take over any touches, I create it in method that shows my picker, and I remove it when I hide it.

Adding it to the window did not help either, as setting :

self.hideLePickerRecognizer.cancelsTouchesInView = YES;

What can I do about it?

Vineet Singh
  • 4,009
  • 1
  • 28
  • 39
Dvole
  • 5,725
  • 10
  • 54
  • 87
  • http://stackoverflow.com/questions/10459184/how-to-detect-a-tap-gesture-in-subviews/10459220#10459220 and http://stackoverflow.com/questions/11485100/allow-uiscrollview-and-its-subviews-to-both-respond-to-a-touch – iPatel Oct 18 '13 at 13:06

1 Answers1

0

I have managed to do that by adding view on top of all views with clear color as background color. When I tap on that, it registers click and does the method to hide picker, then it disables user interaction on itself.

Dvole
  • 5,725
  • 10
  • 54
  • 87