我已实现此方法以返回节标题高度。但是,当该部分的高度发生变化时,它会立即发生而没有动画。
有动画吗?
- (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section {
if (flatHeader) {
return 50.0f;
} else {
return 100.0f;
}
}
最佳答案
我不是 100% 确定这对表格标题有效,但它对表格行有效,所以值得一试。我有一个实例变量 headerHeight
最初设置为 44.0,我将其更改为:
- (void)changeHeight {
[self.tableView beginUpdates];
headerHeight = 88.0;
[self.tableView endUpdates];
}
在我的代码中,我在 heightForRowAtIndexPath
中返回了 headerHeight
,但您可以在 heightForHeaderInSection
中尝试:
- (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section {
return headerHeight;
}
关于iphone - 如何在 UITableView 中为节标题的高度变化设置动画?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2659428/