Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Scrolling in UITableView embedded in UITableviewCell (ios7)

I have UITableView added as subview of UITableviewCell. In iOS 6 when I scroll internal tableView and reach to the end of it main table view becomes scrolling. In iOS 7 it doesn't work anymore. If I am scrolling in internal table view it doesn't deliver this scroll event to parent tableView.

Does anyone know how to simply fix it, without manual transferring event from internal tableview to parent?

Additional info: I find possible reason of problem. But how to fix this problem.

like image 720
abagmut Avatar asked Jan 26 '26 14:01

abagmut


1 Answers

So, I found a solution.

According to tip from @FaisalAli I implement delegate method:

- (BOOL)                         gestureRecognizer: (UIGestureRecognizer*)gestureRecognizer
shouldRecognizeSimultaneouslyWithGestureRecognizer: (UIGestureRecognizer*)otherGestureRecognizer
{
    if ([gestureRecognizer isKindOfClass: [UIPanGestureRecognizer class]])
    {
        if ([((UIPanGestureRecognizer*)gestureRecognizer) velocityInView: self].y > 0)
        {
            // Up
            if (self.contentOffset.y <= 0)
            {
                self.bounces = NO;
                return YES;
            }
        }
        else
        {
            // Down
            if (self.contentOffset.y + self.height >= self.contentSize.height)
            {
                self.bounces = NO;
                return YES;
            }
        }
    }

    self.bounces = YES;

    return NO;
}

And it helped.

like image 128
abagmut Avatar answered Jan 28 '26 02:01

abagmut



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!