So, I have a custom tableview cell in tableview and when I set the editing mode on with the [self.tableView setEditing:YES animated:YES];
code.
It sets the editing mode but the problem is that my label on the cell just teleports to it's new location as it is pushed left when the reorder control shows itself. How can I animate the constraint change when the editing happens?
Picture of the my tableview cell:(The right constraint clearly increases when the editing goes on but it's not animated and I want it to be)
Edit: Here is my cell's setEditing. I have tried to do it in many ways but the animation just doesn't work for some reason, the change happens instantly.
-(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)
{
}];
}
}
Worked for me if I change constraint before animation block
- (void) setEditing:(BOOL)editing animated:(BOOL)animated
{
[self layoutIfNeeded];
self.containerLeftConstraint.constant = editing ? EditingIndent : 0.0f;
[UIView animateWithDuration:0.3
animations:^{
[self layoutIfNeeded];
}];
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With