0

I have a view with many rotating and moving columns. To column i add UIView named element with image and title. For full understanding this image image

My problem strange for me. I add to element tap gesture

gestureTap = [[UITapGestureRecognizer alloc] action:@selector(panoramaTap)];
    [gestureTap setNumberOfTapsRequired:1];

    [gestureTap setNumberOfTouchesRequired:1];
    [gestureTap setDelegate:self];
    [self addGestureRecognizer:gestureTap];

But panoramaTap: work only in some area, which change after moving.

In app like this on iPad all work fine. What is affecting on gesture?

MetalJr
  • 302
  • 4
  • 14
outfoll
  • 73
  • 1
  • 6

1 Answers1

1
[[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(panoramaTap:)];

make sure that your code is exactly like this. target should be self and after paranomaTap in selector there should be ":" character just like shown above.

And the problem is, tap is recognised when both the touchDown position on UIVIEW is same as touchUP position on that view.Since your view is moving, both positions change.So it wont recognise that tap event

santhu
  • 4,796
  • 1
  • 21
  • 29
  • Gesture don't have delaysTouchEvents.. Only Began and Ended. And it's didn't help. – outfoll Dec 20 '13 at 18:11
  • Sorry, my mistake.It doesnt matter anyway. the problem is, tap is recognised when both the touchDown position on UIVIEW is same as touchUP position on that view.Since your view is moving, both positions change.So it wont recognise that tap event. – santhu Dec 20 '13 at 18:16
  • I suggest you use touchesBegan:withEvent: method. 1) create subclass of UIVIEW and add 'imageview and label' as subViews to it. And override touchesBegan method, and use delegate to let your viewController know about it. 2)write touchesBegan: in viewController itself and use CGRectContainsPoint method on imageView frames to check whether touch happened in that view or not. Hope this helps. – santhu Dec 20 '13 at 18:20
  • Yes, only now i detect it, invisible column catch taps. Setting user interaction to NO didn't help. Also i can another calculate center of column. Maybe exist alternative decision. – outfoll Dec 20 '13 at 18:28