热门搜索 :
考研考公
您的当前位置:首页正文

关于TableView自带左滑功能8.x 9.x的区别

来源:东饰资讯网

系统自带左滑功能在9.x的系统中只需要在下面方法中添加

- (NSArray<UITableViewRowAction *> *)tableView:(UITableView *)tableView editActionsForRowAtIndexPath:(NSIndexPath *)indexPath{

    UITableViewRowAction *delAct = [UITableViewRowAction rowActionWithStyle:UITableViewRowActionStyleDefault title:@"删除" handler:^(UITableViewRowAction * _Nonnull action, NSIndexPath * _Nonnull indexPath) {

    }];
    return @[delAct];
}

而在8.x的系统中仅仅是重写这一个方法是不够的,还需要重写下面方法,不需要在其中写内容

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