iOS tableView自定義刪除按鈕

// 自定義左滑顯示編輯按鈕

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

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

        NSLog(@"刪除");

    }];

    rowAction.backgroundColor = [UIColor yellowColor];

    NSArray *arr = @[rowAction];

    return arr;

}
相關文章
相關標籤/搜索