UITableView setEditing不会对标签约束更改进行动画处理

Sam*_*nen 5 cocoa-touch uitableview ios nslayoutconstraint

所以,我在tableview中有一个自定义的tableview单元格,当我用[self.tableView setEditing:YES animated:YES];代码设置编辑模式时.

它设置了编辑模式,但问题是我的单元格上的标签只是传送到它的新位置,因为当重新排序控件显示时它被向左推.编辑发生时,如何设置约束更改的动画?

我的tableview单元格的图片:(当编辑继续时,右边的约束明显增加,但它没有动画,我希望它是)

PIC1

编辑:这是我的单元格的setEditing.我试图在很多方面做到这一点,但动画由于某种原因不起作用,变化立即发生.

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

    if (editing) {
        [UIView animateWithDuration:0.25f
                              delay:0.0f
                            options:UIViewAnimationOptionCurveEaseIn
                         animations:^{
                             self.labelConstraint.constant = 100;
                             [self layoutIfNeeded];

                         }
                         completion:^(BOOL finished)
         {


         }];
    }
}
Run Code Online (Sandbox Code Playgroud)

Pet*_*r K 1

如果我在动画块之前更改约束,则对我有用

- (void) setEditing:(BOOL)editing animated:(BOOL)animated
{
    [self layoutIfNeeded];
    self.containerLeftConstraint.constant = editing ? EditingIndent : 0.0f;

    [UIView animateWithDuration:0.3
                     animations:^{

                         [self layoutIfNeeded];
                     }];

}
Run Code Online (Sandbox Code Playgroud)