how can i make headerView scroll (not stay on the top of the tableview ) accompanying with UItableViewCell when i was scrolling tableview

Solution 1:

You can disable scrolling sectionHeader by changing the table property to -

UITableViewStyleGrouped

You have to set it on the initialisation of UITableView.

  • Change Table Style from Plain to Grouped on StoryBoard

OR

UITableView* table = [[UITableView alloc]initWithFrame:myFrame style:UITableViewStyleGrouped]; 

Solution 2:

Just change style of table from "Plain" to "Grouped".

Solution 3:

subclass the UITableView and override this method

- (BOOL)allowsHeaderViewsToFloat{
    return NO;
}

same for footer

- (BOOL)allowsFooterViewToFloat{
    return NO;
}

But I think that this is a private API ... You will not be able to submit it to the AppStore

If you will upload it to the AppStore; Then you have two other options

  1. Adding a normal cell instead of the section header
  2. If you have only one section, then you can simply use table header instead of section header

Solution 4:

I had the same issue and when i browsed i came to this link See The accepted answer from and I came to conclusion that you need to set tableViewHeader Style to Group and it works Charm.