apolo
apolo

Reputation: 461

UITableView won't bounce back after scrolling down past screen

Here's a video of what's going on: https://imgflip.com/gif/kgvcq

Basically, if the cells scroll past the bottom edge of the screen, it won't bounce back. I've tried updating the contentSize of the tableView but that doesn't seem to be the issue. I've also made sure to declare the rowHeight and still no luck. Lastly, I've made sure the bounce properties of the tableView are set properly.

Sorry for not putting up code, here it is:

// data source
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    NSLog(@"frame height: %f", tableView.frame.size.height);
    NSLog(@"content size height: %f", tableView.contentSize.height);

    static NSString *CellIdentifier = @"HabitCell";

    HabitTableViewCell *cell = (HabitTableViewCell *)[tableView dequeueReusableCellWithIdentifier:CellIdentifier];
    cell.viewController = self;
    cell.delegate = self;

    // edit cell

    return cell;
}

The NSLogs are returning: 568 and 400 respectively. Would it be the frame causing problems? Also, I have not overridden scrollViewDidScroll.

Implemented Data Source Methods

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
    // Return the number of rows in the section.
    return [self.habits count];
}

- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath {
    if ([indexPath isEqual:_expandIndexPath]) {
        return 450 + heightToAdd;
    }
    return 100;
}

Upvotes: 11

Views: 685

Answers (1)

apolo
apolo

Reputation: 461

Fixed: I had a call to scrollToRowAtIndexPath in my UIPanGestureRecognizer method. Removed it and it now works perfectly.

Upvotes: 2

Related Questions