Generic way to detect a touch outside UIView frame
ios, touch, uiview
Solution
Add a UIButton having the frame `CGRectMake(0,0,self.view.frame.size.width,self.view.frame.size.height)` as the first subview to your mainview `(self.view)` , add a selector to this button `(@selector(backgroundTap))` , now add all other subviews like `UITableView` , `UIButton` , etc (as per your requirment) . Now whenever you will click on to the blank space where no Subview is present the backgroundTap selector will be called.
Problem
I have UIViewController with a custom UIView inside (lets call them VC and button). When button is touched, it's bounds and center changes with animation (it becomes bigger and presents a few options to choose from, after choice it resizes back). I would like to know how to "detect" (and dismiss the default action of that touch) a touch outside of the button (just to "hide" the button, in particular to make button resize to default smaller size). Is there any generic way I could do that? VC has a lot of objects inside its view (table views, buttons, text fields, custom charts made with quartzcore, etc), do i need to block "interactivity" on all of those elements during the "big mode" of button?