Permitindo Swipe-to-delete enquanto mostra os controles de reordenamento em UITableView
-
07-07-2019 - |
Pergunta
Eu estou olhando para permitir a reordenação de UITableViewCell
s e exclusão de via furto para excluir, mas não via o círculo de exclusão vermelho.
- (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;
}
Além disso, eu tentei desabilitar o modo de edição e chamando -[UITableViewCell setShowsReorderControl:YES]
sem sorte.
(fonte: booleanmagic.com )
Solução
Eu acho que você vai ter que fazer alguma interceptação evento de toque personalizado.
Em Inglês: se dedo se moveu, x distância, horizontalmente na célula, em que a célula única, em seguida, mostrar o controle de exclusão.
Não tenho certeza como desativar os círculos para a esquerda, mas eu acho que é uma propriedade como "shows de controle reordenar"
Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow