1

I have a UITableViewController that is in a storyboard. I want to add a header to it so I followed the instructions in the following post. I dragged a UIView up on top, and on top of that i dragged a couple of images.

Table Header Views in StoryBoards

Now that seemed to work fine, but the header scrolls along with the entries in table cells when i scroll up. Also, they seem to scroll underneath the time and battery indicator...not sure why that is.

So in the comments of that post i saw that you need to implement the following function to return the UiView to get it to "stick". The only way I saw how to get the UiView from the storyboard was to set the tag and then look it up, also shown below.

-(UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section.
{
     int tagNumber = 2; 
     UIView *headerView = (UIView *)[self.view viewWithTag:tagNumber];
     return headerView;
}

The issue with all of this is the header still scrolls. How can i get the header view to just stay on top?

Thanks!

Community
  • 1
  • 1
Jas Ahluwalia
  • 183
  • 3
  • 15

0 Answers0