2014-09-24 2 views
0

를 표시하지 않는 코드 : 여기 jQuery과 편집 : 셀 편집하지만, 삭제 버튼을 여기에

-(void)buttonEditPressed:(id)sender{ 

    if(_tableView.isEditing){ 

     [_tableView setEditing:NO animated:YES]; 
     [_buttonEdit setTitle:@"Edit" forState:UIControlStateNormal]; 

    } else { 

     [_tableView setEditing:YES animated:YES]; 
     [_buttonEdit setTitle:@"Done" forState:UIControlStateNormal]; 
    } 

    [_tableView reloadData]; 

} 

- (BOOL)tableView:(UITableView *)tableView canEditRowAtIndexPath:(NSIndexPath *)indexPath 
{ 
    // Return NO if you do not want the specified item to be editable. 
    return YES; 
} 

- (UITableViewCellEditingStyle)tableView:(UITableView *)tableView editingStyleForRowAtIndexPath:(NSIndexPath *)indexPath 
{ 
    DLog(@""); 
    return UITableViewCellEditingStyleDelete; 
} 


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


-(void)tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath 
{ 

    //Delete the rows at the Indexpath. 

    //edit data model 

    [_tableView reloadData]; 

} 

는 결과입니다 enter image description here enter image description here

출근이 작품을 삭제는. 그러나 편집 버튼을 누르면 셀이 왼쪽의 빨간색 삭제 버튼의 공간을 표시하는 오른쪽으로 움직이지만 그 버튼은 나타나지 않습니다!

어떻게해야합니까?

답변

0

는이 라이브러리를보십시오 : https://github.com/CEWendel/SWTableViewCell

당신이 원하는에 대한 문서화 큰 사용하기 쉽고 좋아요.

+0

제안 해 주셔서 감사합니다. 오히려 정직하게 버튼을 수동으로 생성하는 것이 아니라 완전히 새로운 라이브러리를 사용하는 것이 좋습니다. 그러나 제안에 대해 감사드립니다! – stackOverFlew

+0

코드의 문제는 왼쪽에보기/단추를 정의하지 않는다는 것입니다. –

+0

어떻게하면됩니까? – stackOverFlew