2014-06-11 4 views
2

선택한 행 아래에 새 행을 추가해야합니다.UITableView insertRowsAtIndexPaths 셀 구분 기호를 제거합니다.

[_dataSource insertObject:newDataObject atIndex:indexPath.row + 1]; 

NSMutableArray *indexPaths = [NSMutableArray array]; 
NSInteger currentCount = indexPath.row; 
[indexPaths addObject:[NSIndexPath indexPathForRow:currentCount+1 inSection:0]]; 

[self.tableView beginUpdates]; 
[self.tableView insertRowsAtIndexPaths:indexPaths withRowAnimation:UITableViewRowAnimationNone]; 
[self.tableView endUpdates]; 

가 올바른 위치에서 새로운 행을 추가 할뿐만 아니라, 선택 행의 상부 전지 세퍼레이터을 삭제 didSelectRowAtIndexPath I는이 코드를 사용하고 있습니다. 내가 도대체 ​​뭘 잘못하고있는 겁니까?

+0

를 추가하면 새 세포가 잘못 높이를 가지고 수 있을까? –

+0

아니요, cellForRowAtIndexPath에 셀을 만들 때 항상 같은 높이를 사용하기 때문에. 또한 내용도 같습니다. – Heisenberg

+0

프로토 타입 셀 번호를 변경하고 셀의 크기를 조정 한 후 문제가 생겼을 때 물어 봤습니다. :) 그리고 서로 겹치기 –

답변

3

UITableViewCell과 같이 보이는 것은 선택한 상태에 구분 기호가 없습니다. UITableViewCellSelectionStyleNone은 강조 표시를 비활성화하지만 셀은 selected입니다.

[tableView beginUpdates]; 
    // insert/delete manipulations 
    [tableView deselectRowAtIndexPath:indexPath animated:NO]; 
    [tableView endUpdates]; 

수정 문제