我想要顯示一個包含多個節的表,並且最初只顯示3個節的元素。當用戶點擊節頁腳時,節頁腳會丟失(成爲零),並且該節的所有元素都將顯示給用戶。調用reloadSections後,初始可見單元格不可見:withRowAnimation:方法
出於這個原因,當用戶點擊頁腳節,我把下面的代碼:
-(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'類型 – user102008 2011-04-27 23:33:27