Search code examples
iphoneobjective-ciosfootersections

ios - How to disable the pull and push of the footer


This question has been thrown around without an answer. YES, we can "hide" the viewForFooterInSection no problem:

In CustomFooterView.m

{

self.hidden = YES;

}

This make the footer invisible, just as making the [UIColor clearColor] would work. And therefore the view still pushes the cells and header when scrolling.

We are looking to make space between sections whether there are cells or not. And have only the headers push each other out of the way. Are dynamically sized footers the way to go? Better approach? Disabling push/pull of footer possible?

Thanks in advance.


Solution

  • I don't know if this will fit your needs but what if you got rid of the footer and changed the height of the headers to add extra space?

       -(CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section{
            CGFloat height;
            switch(section)
            {
                //Keep the first section normal
                case 0:
                {
                    height = 44.0;//Normal Height
                    break;
                }
                default:{
                    height = 88.0;//Extra Space above
                }
    
            }
            return height;
        }