Skip to content
This repository has been archived by the owner on Apr 6, 2020. It is now read-only.

detecting touches outside the parent view #12

Open
eliburke opened this issue Mar 5, 2014 · 0 comments
Open

detecting touches outside the parent view #12

eliburke opened this issue Mar 5, 2014 · 0 comments

Comments

@eliburke
Copy link

eliburke commented Mar 5, 2014

screen shot 2014-03-05 at 4 41 33 pm

In case anyone is interested, I was able to figure out how to use QBPopupMenu when it extends beyond the boundary of the parent view. In my case, it was for a UITextView positioned below a UITableView.

The important trick is that you need to have a common parent UIView that contains the view displaying the popup menu, as well as any views that it overlaps. The parent view needs to have access to the popup menu, so you'll need to allocate it there, or use a singleton. Then, override hitTest in the parentView:

- (UIView *)hitTest:(CGPoint)point withEvent:(UIEvent *)event {
    if ([_popupMenu isVisible]) {
        CGPoint localPoint = [self convertPoint:point toView:_popupMenu];
        UIView * view = [_popupMenu hitTest:localPoint withEvent:event];
        if (view)
            return view;
    }
    return [super hitTest:point withEvent:event];
}

There is no issue here, unless you want to add an example to the Demo. :)

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant