0

I have a UITableView with a header. When I scroll in the section that does not fit all its elements on the screen, I'd like the header to move off screen instead of the normal behavior of staying on top until it is replaced by another section.

Is this doable? I would like to avoid making the header a UITableView row like the elements within the section.

Thanks!

Mark
  • 7,306
  • 8
  • 45
  • 87
  • 1
    You don't want to use a Grouped table view? –  Oct 29 '10 at 00:13
  • Grouped table view would be great if I could make the outlines and background on it clear. The table view seems to ignore me setting its background to clear in IB. :/ – Mark Oct 29 '10 at 00:53
  • Which seems like it's not only my issue. I set the background to clear in Interface Builder and even set the background color of the table view in code, but that ugly background shows up. – Mark Oct 29 '10 at 01:03
  • Got it. Sam Soffes' answer on here did the trick. Thanks for the help aBitObvious! – Mark Oct 29 '10 at 01:08
  • http://stackoverflow.com/questions/894875/how-can-i-set-the-background-of-uitableview-the-tableview-style-is-grouped-to-u – Mark Oct 29 '10 at 01:10

1 Answers1

2

As aBitObvious suggested, use a Grouped Tableview to achieve the section header going off affect. Getting the background clear which is what I require for my project required a bit of searching because there is one critical line that is not so intuitive.

self.tableview.backgroundColor = [UIColor clearColor];
self.tableview.opaque = NO;
self.tableview.backgroundView = nil; // THIS ONE TRIPPED ME UP!
self.tableview.separatorColor = [UIColor clearColor];
Mark
  • 7,306
  • 8
  • 45
  • 87