How to get touches when parent view has userInteractionEnabled set to NO in iOS

To get a view to let touches pass-through but give its subviews handle touches, let userInteractionEnabled on that view to YES and, instead, use this snippet: -(id)hitTest:(CGPoint)point withEvent:(UIEvent *)event { id hitView = [super hitTest:point withEvent:event]; if (hitView == self) return nil; else return hitView; } Source: http://cocoaheads.tumblr.com/post/2130871776/ignore-touches-to-uiview-subclass-but-not-to-its

Is there any way of asking an iOS view which of its children has first responder status? [duplicate]

I really like VJK’s solution, but as MattDiPasquale suggests it seems more complex than necessary. So I wrote this simpler version: Objective-C UIResponder+FirstResponder.h: #import <UIKit/UIKit.h> @interface UIResponder (FirstResponder) +(id)currentFirstResponder; @end UIResponder+FirstResponder.m: #import “UIResponder+FirstResponder.h” static __weak id currentFirstResponder; @implementation UIResponder (FirstResponder) +(id)currentFirstResponder { currentFirstResponder = nil; [[UIApplication sharedApplication] sendAction:@selector(findFirstResponder:) to:nil from:nil forEvent:nil]; return currentFirstResponder; } -(void)findFirstResponder:(id)sender … Read more

How to ignore touch events and pass them to another subview’s UIControl objects?

Probably the best way to do this is to override hitTest:withEvent: in the view that you want to be ignoring touches. Depending on the complexity of your view hierarchy, there are a couple of easy ways to do this. If you have a reference to the view underneath the view to ignore: – (UIView *)hitTest:(CGPoint)point … Read more

UIGestureRecognizer blocks subview for handling touch events

I had a very similar problem and found my solution in this SO question. In summary, set yourself as the delegate for your UIGestureRecognizer and then check the targeted view before allowing your recognizer to process the touch. The relevant delegate method is: – (BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldReceiveTouch:(UITouch *)touch