가
ReloadData이 teble입니다 뷰에 행을 추가 할 수 있지만 일부 애니메이션을 원하는 경우 행이 다음 추가 할 때 이러한 라인을 사용한다 ... 좋은 간단하지만, 지금까지 내가 말할 수있는 애니메이션을하지 않습니다 암호.
-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
NSMutableArray *tempArray = [[NSMutableArray alloc] init];
[tempArray addObject:[NSIndexPath indexPathForRow:indexPath.row+1 inSection:0]];
[mainArray insertObject:@"new row" atIndex:indexPath.row+1];
[[self tableView] beginUpdates];
[[self tableView] insertRowsAtIndexPaths:(NSArray *)tempArray withRowAnimation:UITableViewRowAnimationFade];
[[self tableView] endUpdates];
}
아니요, 배열의 새 행 데이터를로드하지 않습니다. 필요한 것은 테이블의 특정 행을 선택할 때 새 행을 추가하는 것입니다. 기존 테이블에 추가됩니다. – smakstr
흠. 그리고 귀하의 테이블 뷰 컨텐츠의 소스는 무엇입니까? – Morion
numberOfRowsInSection에 의해 반환되는 항목의 수를 변경하고 cellForRowAtIndexPath에서 반환 한 데이터를 적절히 업데이트하면됩니다. 그런 다음 위와 같이 reloadData를 호출하십시오. –