9
섹션의 첫 번째 셀에 대해 reloadRowsAtIndexPaths를 호출하면 이전 섹션이 비어 있고 위의 섹션은 비어 있지 않은 상태에서 다시로드 된 셀 (예 : "UITableViewRowAnimationNone"을 지정하더라도)이 이상한 애니메이션 결함이 발생합니다. UITableView reloadRowsAtIndexPaths 그래픽 결함
내가 최대한 예를 단순화하기 위해 노력 .. 아래 위의 절에서 슬라이드 :- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
{
return 3;
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
if (section == 0)
return 1;
else if (section == 1)
return 0;
else if (section == 2)
return 3;
return 0;
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
static NSString *CellIdentifier = @"Cell";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil) {
cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier] autorelease];
}
// Configure the cell...
cell.textLabel.text = @"Text";
return cell;
}
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
NSArray *editedCell = [[NSArray alloc] initWithObjects:indexPath, nil];
//[self.tableView beginUpdates];
[self.tableView reloadRowsAtIndexPaths:editedCell withRowAnimation:UITableViewRowAnimationNone];
//[self.tableView endUpdates];
}
- (NSString *)tableView:(UITableView *)tableView titleForHeaderInSection:(NSInteger)section {
return @"Section";
}
는 사실 마지막 방법을 언급 할 수 있지만, 문제의 더 나은 이해를 제공합니다.
어쨌든 훌륭한 반응입니다. reloadRowsAtIndex가 버그를 전달합니까, 아니면 방금 잘못된 방식으로 사용하고 있었습니까? – Fr4ncis
@ Fr4ncis, 확실하지 않습니다. 셀 테이블 뷰를 다시로드하려면 뷰 계층 구조에서 뷰를 추가/제거하고 하위 뷰 또는 다른 일부를 다시 빌드해야합니다. 즉, 모든 변환이 내부적으로 구현되는 방식에 따라 다릅니다. – Vladimir
감사합니다. 솔루션은 잘 정리되어 있습니다. – jalopezsuarez