0

I am using :

       UITapGestureRecognizer *gestureRecognizer = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(handleViewClicked:)];
       [tmp addGestureRecognizer:gestureRecognizer];
       [gestureRecognizer release];

to get notification when a view(bigview for our example) i clicked(I have a lot of view), and in the front there is a UIView (a blank one) the he is in the front of the view (there is a reason why this view is in the front before al the views).

there is now a problem to get notification when tmp is tapped because the bigview is in the front.

there is any solution for something like this?

EDIT


In the bigview i have UISwipeGestureRecognizer:

UISwipeGestureRecognizer *recognizer = [[UISwipeGestureRecognizer alloc] initWithTarget:self action:@selector(handleSwipeRight:)];
        [recognizer setDirection:(UISwipeGestureRecognizerDirectionRight)];
        [itemsView addGestureRecognizer:recognizer];
        [recognizer release];

and if i make userInteractionEnabled in the bigview to NO he don't get notification on swipe

YosiFZ
  • 7,792
  • 21
  • 114
  • 221
  • Referring to your EDIT; "he don't get notification on swap" - did you mean to write "on swipe"? – Till Jan 09 '12 at 09:48

1 Answers1

0

Two options:

A. Set userInteractionEnabled to NO on that big/blank view.

B. Implement pointInside:withEvent: on that big/blank view

- (BOOL)pointInside:(CGPoint)point withEvent:(UIEvent *)event 
{
    // UIView will be "transparent" for touch events if we return NO
    return NO;
}

(as taken from allowing-interaction-with-a-uiview-under-another-uiview)

Community
  • 1
  • 1
Till
  • 27,559
  • 13
  • 88
  • 122
  • @MTA if I understand you correctly, then this "big" view should sometimes get touch-events and sometimes it should not, correct? – Till Jan 09 '12 at 09:39
  • the big view always get UISwipeGestureRecognizer event but the views below him get UITapGestureRecognizer events – YosiFZ Jan 09 '12 at 10:23