2013-08-19 4 views
0

UITableView를 편집 가능하도록 구성했습니다. 어떤 이유로, 편집 버튼을 누르면 특정 행만 실제로 편집 할 수 있습니다.UITableView 특정 행을 편집 할 수 없습니다

행을 삭제하는 데 사용되는 빨간색으로 표시되는 모든 원이 표시되지 않는 것은 아닙니다.

여기는 Quicktime video demonstrating the problem입니다.

행을 스 와이프하여 삭제하는 경우 (상단의 수정 버튼으로 시작하는 대신) - 일부 행을 편집 할 수 있습니다. 일부는 아니오입니다. 1. (말, 2 개 항목)에있는 tableview 채우기 2. 두 항목을 삭제 3. 5 개 항목이 항목의 4 세 추가 : 여기

은 아래 나는이 상황이 발생할 이벤트의 순서입니다 삭제 될 수 있습니다. 다른 두 개 (테이블에 처음 채워지는 번호와 같습니다)는 삭제할 수 없습니다.

나는 약간 당황 스럽다. 어떤 도움이라도 대단히 감사 할 것입니다. 감사!

- (void)setEditing:(BOOL)editing animated:(BOOL)animated { 
automaticEditControlsDidShow = NO; 
[super setEditing:editing animated:animated]; 

if (editing) { 
    automaticEditControlsDidShow = YES; 
    [self.tableView insertRowsAtIndexPaths:addRow withRowAnimation:UITableViewRowAnimationLeft]; 
} else { 
    [self.tableView deleteRowsAtIndexPaths:addRow withRowAnimation:UITableViewRowAnimationLeft]; 
} 
} 

아니면 editingStyleForRowAtIndexPath 메소드를 구현하려고 :

+1

'canEditRowAtIndexPath :/editingStyleForRowAtIndexPath :'모양은 무엇입니까? –

+0

canEditRowAtIndexPath의 결과가 기록되었으며 항상 true를 반환합니다. 또한 false를 반환하면 동작이 달라집니다. 빨간색 원은 표시되지 않습니다. – bbrame

+0

editingStyleForRowAtIndexPath가 구현되지 않았습니다. – bbrame

답변

0

는 저희 집보기 대리자를 구현할 때, 클래스에이를 추가하려고합니다. 예 :

- (UITableViewCellEditingStyle)tableView:(UITableView *)tableView editingStyleForRowAtIndexPath:(NSIndexPath *)indexPath { 

return UITableViewCellEditingStyleDelete; 
} 
관련 문제