UITableView 在错误的时间缩进

UITableView indents at the wrong time

我的导航栏左上角有一个默认的编辑按钮。当它按下时,该死的 table 第一次不显示缩进。当我按下 "done" 时,它确实如此!我该如何解决这个问题?

这是我的代码:

- (void)viewDidLoad {

    self.navigationItem.leftBarButtonItem = self.editButtonItem;

}


#pragma mark edit


- (void)setEditing:(BOOL)editing animated:(BOOL)animated {
    [super setEditing:editing animated:animated];
    [_tableView setEditing:editing animated:animated];

}

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

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



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



}

编辑

重写 UITableViewCell 子类中的这两个方法为我删除了缩进。

- (void)willTransitionToState:(UITableViewCellStateMask)state
- (void)didTransitionToState:(UITableViewCellStateMask)state

所以我现在可以制作自己的动画了。

重写 UITableViewCell 子类中的这两个方法为我删除了缩进。

 - (void)willTransitionToState:(UITableViewCellStateMask)state
 - (void)didTransitionToState:(UITableViewCellStateMask)state

所以我现在可以制作自己的动画了。