简体   繁体   中英

UITableview refreshing cells scrolling under section header

I am using UzysCircularProgressPullToRefresh in order to refresh my tableview. My UITableView have 1 static section with a title and I want it always fixed at the top of the table(That's why I don't want to use UITableViewStyleGrouped). When the UITableView is in refreshing state, and I start scrolling it, the cells are being scrolling under the header section which is very bad as a design. Kindly check the image 在这里检查图像

You can test it by yourself by adding the following to the project:

-(NSString *)tableView:(UITableView *)tableView titleForHeaderInSection:(NSInteger)section
{
    return @"Header Section";
}

I tried to find a solution but didn't find any after lot of searching. Can anyone help me solving this? how to fix this design issue in any way?

- (void)scrollViewDidScroll:(UIScrollView *)scrollView {
    CGFloat navBarMaxY = CGRectGetMaxY(self.navigationController.navigationBar.frame);
    if (scrollView.contentInset.top > navBarMaxY) {
        if (scrollView.contentInset.top > -scrollView.contentOffset.y) {
            UIEdgeInsets insets = scrollView.contentInset;
            insets.top = MAX(-scrollView.contentOffset.y, navBarMaxY);
            scrollView.contentInset = insets;
        }
    }
}

I had this problem myself once.

For me, the solution was to drag'n'drop the UITableView so it wasn't the first element in my view.

https://stackoverflow.com/a/27815006/391605

Dumb, hey ? Give it a go.

Hope this helps.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM