Search code examples
ipaduitableviewios4

How to remove header and footer space from a UITableView?


I have a UITableView in the grouped style, and only one section. However there is some blank space above and below the table view that is shown when the user scrolls too far. How can I remove this blank space?


Solution

  • You can do this by altering the contentInset property that the table view inherits from UIScrollView.

    self.tableView.contentInset = UIEdgeInsetsMake(-20, 0, -20, 0);
    

    This will make the top and bottom touch the edge.