UITapGestureRecognizer tap on self.view but ignore subviews

I need to implement a feature that will invoke some code when I double tap on the self.view (view of

UIViewCotroller

). But the problem that I have other UI object on this view and I don't want to attach any recognizer object to all of them. I found this method below how to make gesture on my view and I know how it works. Right now I am in front of handicap which way to choose for create this recognizer ignoring subview. Any ideas? Thanks.

You should adopt the UIGestureRecognizerDelegate protocol inside the self object and call the below method for checking the view. Inside this method, check your view against touch.view and return the appropriate bool (Yes/No). Something like this: