I have a subview, and part of the view is transparent, so to the user, if they were to touch in that transparent space then whatever is visible (but also underneath it) should be interactive.
- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event {
CGPoint pt = [[touches anyObject] locationInView:self];
if (CGRectContainsPoint(tableViewUse.frame, pt)){
[self becomeFirstResponder];
}else {
[super becomeFirstResponder];
}
}
I have the above code in my subview class, but the problem is that the [super becomeFirstResponder] call is not working. Now the obvious solution is to have a [self resignFirstResponder] call in the class of my superview; however, I plan to use many instances of this class in my code, so I would have to find the touch and compare it against the frame of each of my instances etc. So the elegant solution is to control everything from the subview.
Thank you for any help!
P.s just noticed a problem that will change my question. If I were to make the superview become the first responder, then any touchesBegan method will be called in that superview and the touch will have to be managed there. eeeeeek.