0

I have a UITableView to implement a function like when I click the cell , I want it column down and show a music player kinda cell with slider and pause button on it, so I think I can use every cell as a section include 2 rows, when I click I reload section and give the second row a different cell style as playerCell. but the problem is I only want the first sectionHeaderView to fix , when I return nil and 0.0 for the rest sections's sectionHeaderView then my first sectionHeaderView disappear when I scroll up after the second section scroll up. so how can I fix only the first sectionHeaderView and make other sectionHeaderView be empty?

enter image description here

Nikolay Kostov
  • 16,433
  • 23
  • 85
  • 123
SevenJustin
  • 61
  • 11

2 Answers2

0

If section is 0 then set your section header view's height to Zero, no need to return nil.

Ruchish Shah
  • 319
  • 1
  • 6
  • it seems not work, when there is 0 for the second header with no nil view this time, then i scroll up the first headerView disappear too, replace it with a 0 height header and empty headerView that's what i called "the first sectionHeaderView disappear" – SevenJustin Jul 23 '15 at 04:35
0

Give the required height in the follwing function by comparing sections

- (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section
{ 
  if (section==0)
  {
    //height you want
  }
}
swapnali patil
  • 304
  • 2
  • 17
  • - (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section{ if (section != 0) { return 0; } return 85*UI_RATE; } when the second headerView height equals to 0, then i think the 0 view replace the 85 view , then it also disappear! – SevenJustin Jul 23 '15 at 04:40
  • check what height you are returning...& try if possible to use reloadSections using the following method - (void)reloadSections:(NSIndexSet *)sections withRowAnimation:(UITableViewRowAnimation)animation – swapnali patil Jul 23 '15 at 04:50
  • the result is when the first section i return 85 else return 0, and where n when should i call reloadSections method? – SevenJustin Jul 23 '15 at 05:05