Touch events are only visible. Although it is possible to post a review outside of your parents and still see it, events will not be shared with him.
The main event handling mechanism is the following UIView method:
- (UIView *)hitTest:(CGPoint)point withEvent:(UIEvent *)event
This method is responsible for determining which gaze this touch event should go to. When you touch the screen, the root view (window) hitTest method is called, and it will call the subviews method on it, and they will call the method in their subzones, etc.
Basically, you can create a custom window class and override the hitTest method in your window to make it forward events to the button, even though it is outside its parent boundaries, but it is quite difficult to do this correctly. It will be something like this:
- (UIView *)hitTest:(CGPoint)point withEvent:(UIEvent *)event { CGRect rect = WORK_OUT_WHERE_THE_BUTTON_RECT_IS_RELATIVE_TO_THE_WINDOW; if (CGRectContainsPoint(rect, point)) { return theButtonView; } else { return [super hitTest:point withEvent:event]; } }
Instead, I suggest you save a lot of hassle and change the way your application works by adding your button as a subzone of the navigation bar, instead of using negative positioning to place it there.
source share