UIContextualActionStyle - 操作按钮的样

2020-05-21  本文已影响0人  js_huh

是什么?


"完全滑动":多个按钮,因滑动而成为1个按钮。


什么特点?


completionHandler 是什么?


UIContextualActionStylecompletionHandler 结合应用时的区别?


问题:

UIContextualAction * deleteAction =  [UIContextualAction contextualActionWithStyle:UIContextualActionStyleDestructive title:@"删除" handler:^(UIContextualAction * _Nonnull action, __kindof UIView * _Nonnull sourceView, void (^ _Nonnull completionHandler)(BOOL)) {
    NSLog(@"删除....");
    if (self.wineData.count > indexPath.row) {
            [self.wineData removeObjectAtIndex:indexPath.row];
            //局部刷新
            [tableView deleteRowsAtIndexPaths:@[indexPath] withRowAnimation:UITableViewRowAnimationLeft];
        }
        //执行操作
        completionHandler(NO);
    }];

也可以看看

UISwipeActionsConfiguration - 表格行滑动后的操作配置
UIContextualAction - 用户滑动表格行后,执行操作的事件
UIContextualActionHandler - 执行操作的代码块


来自于哪里?

上一篇 下一篇

猜你喜欢

热点阅读