이 동작은 7.0의 iOS 7.1에만 해당되며 의도 한대로 동작합니다.UITableView - 7.0이 아닌 7.1에서 셀을 확장 할 때 간혹 스크롤합니다.
다른 높이의 셀이있는 UITableView가 있습니다. 어디 있는지 셀의 상단이 유지, 셀이 아래쪽으로 확장 - 그들 중 하나를 탭하면있는 tableView의 상단에 행을 두드리고 때 의도 한대로 모든 동작,
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
if (indexPath.row != self.selectedCellIndexPath.row) {
// Close previously opened cell
if (self.selectedCellIndexPath != nil) {
[tableView beginUpdates];
[(MyTableViewCell *) [tableView cellForRowAtIndexPath:self.selectedCellIndexPath] collapse];
[tableView endUpdates];
}
self.selectedCellIndexPath = indexPath;
[tableView beginUpdates];
[(MyTableViewCell *) [tableView cellForRowAtIndexPath:indexPath] expand];
[tableView endUpdates];
}
else if (indexPath.row == self.selectedCellIndexPath.row) {
self.selectedCellIndexPath = nil;
[tableView beginUpdates];
[(MyTableViewCell *) [tableView cellForRowAtIndexPath:indexPath] collapse];
[tableView endUpdates];
}
}
를 통해 확장합니다. 그러나 아래로 스크롤하여 테이블 뷰 맨 아래에서 셀을 가볍게 두 드리면 셀이 아래쪽으로 이동하고 확장됩니다. 세포가 더 내려갈수록 악화됩니다.
I 테이블 셀 높이 이런 식으로 산출있어 :
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath {
self.prototypeCell = [[MyTableCell alloc] initReuseIdentifier:CellIdentifier];
[self configureCell:self.prototypeCell forIndexPath:indexPath];
float height = 38;
if ([indexPath isEqual:self.selectedCellIndexPath]) {
height += [self.prototypeCell expandedHeight] + 5;
}
return height;
}
이 난 상단이나있는 tableView 하단의 셀을 탭하면 효과가 다르다는 것을 초조 해요. 또한이 효과는 아래로 스크롤 한 후에 만 처음입니다. 반복 할 때, 세포는 의도 된대로 그 위치에 머문다. 위아래로 스크롤 한 후에 만 처음에는 잘못 작동합니다.
도와 주셔서 감사합니다. 아는 경우 이유를 설명해주세요. –