【发布时间】:2011-03-09 02:38:16
【问题描述】:
我想显示一个包含多个部分的表格,最初只显示 3 个部分元素。当用户点击部分页脚时,部分页脚会丢失(变为 nil)并且该部分的所有元素都将显示给用户。
因此,当用户点击节页脚时,我调用以下代码:
-(void)loadMoreRowsInSection:(NSInteger)section {
[groupStates replaceObjectAtIndex:section withObject:[NSNumber numberWithBool:YES]];
[self.tableView reloadSections:[NSIndexSet indexSetWithIndex:section] withRowAnimation:NO];
}
我有以下代码来显示节页脚:
-(UIView*)tableView:(UITableView *)tableView viewForFooterInSection:(NSInteger)section {
int count = [[(NSDictionary*)[filters objectAtIndex:section] valueForKeyPath:@"values.value"] count];
if (count>3&&![[groupStates objectAtIndex:section] boolValue]) {
LoadMoreFooter* loadMoreFooter = [[LoadMoreFooter alloc] initWithParent:self Section:section];
return [loadMoreFooter view];
}
else return nil;
}
当用户点击节页脚并调用 loadMoreRowsInSection 函数时,会重新加载此节,但该节的当前行会消失。当我向上向下滚动时,使行离开屏幕并再次进入,行再次出现。
如果我调用reloadData 而不是reloadSections:withRowAnimation:,则没有问题,但重新加载所有表似乎不是一个好主意。另外,reloadTable 中没有动画。
有人遇到过这个问题吗?
【问题讨论】:
-
-reloadSections:withRowAnimation:的第二个参数不是BOOL;这是一个UITableViewRowAnimation类型
标签: iphone uitableview footer