UiSwipeActionsConfiguration - 单元格在第一次启动时重新加载自身

UiSwipeActionsConfiguration - Cell reloads itself on first start

Cell 在第一次启动时重新加载它的操作,但是 trailingSwipeActionsConfigurationForRowAtIndexPath 只被调用一次,有什么想法吗?

代码:

- (UISwipeActionsConfiguration *)tableView:(UITableView *)tableView trailingSwipeActionsConfigurationForRowAtIndexPath:(nonnull NSIndexPath *)indexPath {

UIContextualAction *deleteAction = [UIContextualAction contextualActionWithStyle:UIContextualActionStyleNormal title:nil handler:^(UIContextualAction * _Nonnull action, __kindof UIView * _Nonnull sourceView, void (^ _Nonnull completionHandler)(BOOL)) {

   //...

}];

UIContextualAction *moreAction = [UIContextualAction contextualActionWithStyle:UIContextualActionStyleNormal title:@"" handler:^(UIContextualAction * _Nonnull action, __kindof UIView * _Nonnull sourceView, void (^ _Nonnull completionHandler)(BOOL)) {

    //...

    completionHandler(YES);
}];

deleteAction.backgroundColor = [UIColor colorWithRed:(245/255.0) green:(78/255.0) blue:(70/255.0) alpha:1];
moreAction.backgroundColor = [UIColor colorNamed:@"CL_LightGray_2"];

UISwipeActionsConfiguration *SwipeActions = [UISwipeActionsConfiguration configurationWithActions:@[deleteAction,moreAction]];
SwipeActions.performsFirstActionWithFullSwipe=false;
return SwipeActions;

}

我找到问题了!对于所有以后遇到同样问题的人:

    [UIView animateWithDuration:1.0 animations:^{

    //...

  }];

一旦在别处执行此代码,单元格的操作也会重新加载。这会产生奇怪的行为。