UITableView with fixed section headers

The headers only remain fixed (floating) when the UITableViewStyle property of the table is set to UITableViewStylePlain.

If you have it set to UITableViewStyleGrouped, the headers will scroll up with the cells (will not float).


Change your TableView Style:

self.tableview = [[UITableView alloc] initwithFrame:frame style:UITableViewStyleGrouped];

As per apple documentation for UITableView:

UITableViewStylePlain- A plain table view. Any section headers or footers are displayed as inline separators and float when the table view is scrolled.

UITableViewStyleGrouped- A table view whose sections present distinct groups of rows. The section headers and footers do not float.

Hope this small change will help you ..