I have this big UICollectionView
occupying major part of screen and there is a UIButton
that shows a menu. I want to hide the menu when the user taps on any side of the screen which becomes unfortunately any part of UICollectionView
for me. Tried on other view the below code, it works well...but not for UICollectionView
. The function does not gets called.
override func touchesBegan(touches: Set<NSObject>, withEvent event: UIEvent) {
hidemenu()
self.view.endEditing(true)
}
What is the problem? Thanks for your time.
OR
How to trigger touchesBegan
in the UIViewController
where UICollectionView
resides