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?
Asked
Active
Viewed 78 times
0

Nikolay Kostov
- 16,433
- 23
- 85
- 123

SevenJustin
- 61
- 11
-
Really not sure what you're trying to implement. Can you maybe add a couple of images to illustrate what want to accomplish? – brandonscript Jul 23 '15 at 04:19
-
@remus i'm sorry i can't add image due to the account limits, do you have Wechat or other tool, i can send you my idea. thanks. – SevenJustin Jul 23 '15 at 04:22
-
Just upload them to imgur, add the links to your question, and someone will edit them in. – brandonscript Jul 23 '15 at 04:24
-
@remus image updated! – SevenJustin Jul 23 '15 at 04:32
-
I see. Can you just do an `if (row.index == 0) show header` type solution? – brandonscript Jul 23 '15 at 04:35
2 Answers
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