Habilitar deslizar para eliminar mientras se muestran los controles de reordenamiento en UITableView
-
07-07-2019 - |
Pregunta
Estoy buscando permitir el reordenamiento de UITableViewCell
sy eliminarlo mediante deslizar para eliminar, pero no a través del círculo rojo de eliminación.
- (void)loadView
{
[super loadView];
[table setEditing:YES animated:NO];
}
- (void)tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath
{
if (editingStyle == UITableViewCellEditingStyleDelete) {
// Perform delete here
}
}
- (void)tableView:(UITableView *)tableView moveRowAtIndexPath:(NSIndexPath *)fromIndexPath toIndexPath:(NSIndexPath *)toIndexPath
{
// Perform move here
}
- (UITableViewCellEditingStyle)tableView:(UITableView *)tableView editingStyleForRowAtIndexPath:(NSIndexPath *)indexPath
{
return UITableViewCellEditingStyleDelete;
}
- (BOOL)tableView:(UITableView *)tableView canMoveRowAtIndexPath:(NSIndexPath *)indexPath
{
return YES;
}
Además, he intentado deshabilitar el modo de edición y llamar a - [UITableViewCell setShowsReorderControl: YES]
sin suerte.
(fuente: booleanmagic.com )
Solución
Creo que tendrá que hacer una intercepción de eventos táctiles personalizada.
En inglés: si el dedo se movió, x distancia, horizontalmente a través de la celda, solo en esa celda, luego muestre el control de eliminación.
No estoy seguro de cómo desactivar los círculos a la izquierda, pero creo que es una propiedad como "muestra el control de reordenamiento"
Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow