Question

I have one viewcontroller in which I have added tableview in full screen and I have also one back button on tableview. Now when view appears after 2 second I am reducing alpha of backbutton and When user touches in screen anywhere I am again displaying with alpha 1.

To acheive this in a view which have tableview I have added tap gesture to tableview and on tap I am setting backbutton alpha to 1. But now problem is there when I added this method to tableview I cant access tableview didselectrow: metod.

Can anyone help me on this ? I want to do this with one tap only. Here is screenshot: enter image description here

No correct solution

OTHER TIPS

I'm not quite sure I understand why you want to do this, but:

  • You could remove the gesture recogniser after the first time it is triggered
  • Or, you could not use your own gesture recogniser, and simply do whatever it is you want to do the first time didSelectRow... is called (by setting a flag, or checking some other state, to decide whether to do this one-time-thing or not).

Set the UIGestureRecognizer property cancelsTouchesInView to NO in order to pass the touches to the view.

mRecognizer.cancelsTouchesInView = NO;

You Can use the Gesture recognizer delegate method to check if the touch point is inside the tableView like below

- (BOOL)gestureRecognizerShouldBegin:(UIGestureRecognizer *)gestureRecognizer
{

    CGPoint point=[gestureRecognizer locationInView:containerView];
    CGRect AreaNotinterested=///calculate the area you want recognizer to skip
    if (CGRectContainsPoint(AreaNotinterested, point)) {
        return NO;
    }
    else
        return YES;
}

Use this method to tell the delegate whether to start or stop the UIGestureRecognizer

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top