현재 위치를 유지하면서 높이 변경을 애니메이션으로 변경하면서 UITableView의 모든 셀을 확장/축소 할 수 있기를 바랍니다. 기본적으로보기의 현재 셀이 확장/축소되고 스크롤 위치가 동일하게 유지되어야합니다. 내가/확장 높이가 다른 2 개 개의 상태를 갖는 스크롤 위치를 유지하면서 모든 UITableViewCells의 애니메이션 높이를 변경하십시오.
[self.tableView reloadSections:[NSIndexSet indexSetWithIndex:0] withRowAnimation:UITableViewRowAnimationAutomatic];
를 호출하여 세포를 접촉 할 수있어 내가 수행하여 같은 위치를 유지하기 위해 노력했습니다
는 (100 %이 계산은 정확) :이 작업의 종류에 보이는 동안은 애니메이션으로,이 위치를 유지하지 않습니다
//calculate the new position it should scroll to based on new cell height
CGFloat posFromTop = self.tableView.contentOffset.y;
CGFloat newDistance = 0;
if(expandedState)
{
CGFloat cellsFromTop = posFromTop/kExpandedCellHeight;
newDistance = cellsFromTop * kCollapsedCellHeight;
}
else
{
CGFloat cellsFromTop = posFromTop/kMGLCollapsedCellHeight;
newDistance = cellsFromTop * kMGLExpandedCellHeight;
}
}
//reload section
[self.tableView setContentOffset:CGPointMake(0, newDistance) animated:YES];
[self.tableView reloadSections:[NSIndexSet indexSetWithIndex:0] withRowAnimation:UITableViewRowAnimationAutomatic];
, 그것은 흰색 깜박하고 그래서 고르지의와있는 tableView가 재로드시에 여전히 머물고있다처럼 보이지 않는다.
누구나 동일한 위치를 유지하면서 모든 셀의 높이를 부드럽게 애니 메이팅 할 수있는 방법이 있습니까?
해결책을 찾았습니까? – sim