简体   繁体   English

UITableview重新加载SectionHeader,但不重新加载section中的单元格

[英]UITableview reload SectionHeader but not cells in section

I have a tableview where I want to reload (and change the height of) just the sectionHeader but not the cells inside this section. 我有一个tableview,我只想重新加载(并更改其高度)sectionHeader,而不要重新加载此部分中的单元格。 The reason I want to do this is because I use the fade animation on the header, like so: 我想要这样做的原因是因为我在标题上使用了淡入淡出动画,如下所示:

[self.tableView reloadSections:[NSIndexSet indexSetWithIndex:0]   
    withRowAnimation:UITableViewRowAnimationFade];

But at the same time I am adding a cell in that section with 但与此同时,我在该部分中添加了一个单元格,

[self.tableView insertRowsAtIndexPaths:
    @[[NSIndexPath indexPathForRow:0 inSection:0]]
    withRowAnimation:UITableViewRowAnimationRight];

I'd like to be able to keep the UITableViewRowAnimationRight for the cell that is being added, but when I reload the Section, the fade animation gets applied to the whole section. 我希望能够为要添加的单元格保留UITableViewRowAnimationRight ,但是当我重新加载Section时,淡入淡出动画将应用于整个section。 Is there any way to just reload the sectionHeader, and not the cells in the section? 有什么方法可以重新加载sectionHeader,而不是部分中的单元格吗?

Just create 2 separate brackets of 只需创建2个单独的括号即可

[tableView beginUpdates];
[tableView endUpdates];

for the two insertions / changes. 对于两次插入/更改。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM