Ios UITableView自定义页脚消失
我使用了自定义UITableView页脚,它工作正常,但当我在heightForRowAtIndexPath中更改单元格高度时,页脚就消失了 编辑: 我在这里创建页脚Ios UITableView自定义页脚消失,ios,uitableview,Ios,Uitableview,我使用了自定义UITableView页脚,它工作正常,但当我在heightForRowAtIndexPath中更改单元格高度时,页脚就消失了 编辑: 我在这里创建页脚 -(UIView *)tableView:(UITableView *)tableView viewForFooterInSection:(NSInteger)section { actStreamFooter = [[[NSBundle mainBundle]loadNibNamed:@"AcvitityStreamFo
-(UIView *)tableView:(UITableView *)tableView viewForFooterInSection:(NSInteger)section
{
actStreamFooter = [[[NSBundle mainBundle]loadNibNamed:@"AcvitityStreamFooter" owner:self options:nil]objectAtIndex:0];
footerHeight = actStreamFooter.frame.size.height;
UIButton *taptoLoad = [[UIButton alloc]initWithFrame:CGRectMake(0, 0, actStreamFooter.frame.size.width, actStreamFooter.frame.size.height)];
[taptoLoad addTarget:self action:@selector(tapToLoad) forControlEvents:UIControlEventTouchUpInside];
[actStreamFooter addSubview:taptoLoad];
if (section == 1) {
return actStreamFooter;
}
else{
return nil;
}
}
那么当我打电话的时候
-(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
因为我需要更新行,因为每个单元格内都有一个展开视图
更改高度后,页脚消失,我尝试了
[tableView reloadData]
它可以工作页脚不会消失,但在重新加载时会闪烁一个小故障。我想消除这个问题,需要为每个部分初始化并返回一个新的页脚。ui视图
不能多次出现在视图继承权中 你到底在哪里设置页脚?我编辑了这个问题。你是直接用你的代码调用heightforrowatinexpath
吗?旁注-将大部分代码移到if
语句中。如果您只需要在一个部分中使用这些代码,为什么要为每个部分运行所有这些代码?