2017-04-25 3 views
0

테이블 편집 모드를 사용할 때 표 셀의 내용이 왼쪽으로 이동하지 않도록하고 싶습니다. 에 제안UITableView의 shouldIndentWhileEditingRowAtIndexPath : 호출되지 않음

- (BOOL)tableView:(UITableView *)tableView shouldIndentWhileEditingRowAtIndexPath:(NSIndexPath *)indexPath { 
    return NO; 
} 

:

Prevent indentation of UITableViewCell (contentView) while editing

그러나 이제까지 호출하지 않는 것 내보기 컨트롤러에서 다음 UITableViewDelegate 방법을 구현했습니다. 이 중 하나가 작동하지 않았다 : 나는 테이블 뷰의 delegate 속성이 있음을 확인을 두 번

- (NSArray<UITableViewRowAction *> *)tableView:(UITableView *)tableView 
        editActionsForRowAtIndexPath:(NSIndexPath *)indexPath { 
    NSMutableArray<UITableViewRowAction *> *actions = [NSMutableArray array]; 
    id clearHandler = ^(UITableViewRowAction *action, NSIndexPath *indexPath) { 
      ... 
    }; 
    UITableViewRowAction *clearAction = [UITableViewRowAction 
             rowActionWithStyle:UITableViewRowActionStyleDestructive 
             title:@"Clear\nStatus" 
             handler:clearHandler]; 
    [actions addObject:clearAction]; 

    id editHandler = ^(UITableViewRowAction *action, NSIndexPath *indexPath) { 
     ... 
    }; 
    UITableViewRowAction *editAction = [UITableViewRowAction 
             rowActionWithStyle:UITableViewRowActionStyleNormal 
             title:@"Edit" 
             handler:editHandler]; 
    [actions addObject:editAction]; 

    return actions; 
} 

: I는 다음과 같이 정의 된 사용자 정의 편집 행 행동의 몇 가지를 사용하고

cell.shouldIndentWhileEditing = NO; 

을 뷰 컨트롤러를 가리키고있다. 내가 뭘 놓치고 있니?

표보기 스타일은 그룹화되지 않았습니다 (예 : 일반).

+0

그룹화 된 테이블보기를 사용하고 있습니까? 'UITableView.h' : "이 방법은 그룹화 된 스타일 테이블 뷰에만 적용됩니다." – norders

+0

문제를 해결 했습니까? –

+0

@norders 표 스타일은 평범합니다. 따라서 일반 테이블 뷰에서이를 수행 할 수 없습니까? – iosdude

답변

0

설정 위임 및 데이터 소스 방법은

  • 당신은 참으로 jQuery과의 allowsSelectionDuringEditing 속성을 설정합니다.
관련 문제