3

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 check the Image here

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?

Iphone User
  • 1,930
  • 2
  • 17
  • 26

2 Answers2

1
- (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;
        }
    }
}
Dmitry Arbuzov
  • 315
  • 2
  • 6
0

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.

Community
  • 1
  • 1
Mike Gledhill
  • 27,846
  • 7
  • 149
  • 159
  • I am not using xib in my project. It is all written by code. You can also check it in the UzysCircularProgressPullToRefresh project from GitHub. – Iphone User Jan 24 '16 at 16:38
  • Even if you're not using a .xib file, what you're seeing does look identical to the Xcode bug I was seeing... So, it might still be worth *inserting* a component as the first subview item in your UIViewController. – Mike Gledhill Jan 25 '16 at 09:30