Utilizo IB y desmarco la opción 'Mostrar selección en contacto' pero todavía muestra el resaltado azul en la celda que está seleccionada. ¿Es esto un error con la manzana o estoy obteniendo algo mal?un problema al deshabilitar ¿Mostrar selección al tocar UITableview?
Respuesta
Esto es probablemente un error en IB como se ve en la documentación que la vista de tabla no tiene ninguna propiedad para la selección de espectáculos en contacto. Es la propiedad de la celda de vista de tabla en lugar de. Por lo tanto, la casilla de verificación no debería estar presente en el IB. Probablemente puedas presentar un error con la manzana y ver qué dicen al respecto.
Para conseguir el efecto que debe hacerlo como:
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil) {
cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier2];
[cell setSelectionStyle:UITableViewCellSelectionStyleNone];
}
}
Espero que esto ayude.
Yo también siento que es muy probable que sea un error. Sin embargo, me topé con una solución perfecta basada en las siguientes observaciones.
- The cell is
highlighted
on touch down andselected
on touch up. - Ambos
-setHighlighted:animated:
y-setSelected:animated:
resaltan la celda de acuerdo con su estilo de selección, es decir, al encender cualquiera de ellos mientras el otro está apagado, se resalta la celda. - La celda nace con
highlighted
apagada (normalmente, de lo contrario, la solución a continuación solo necesita un ajuste apropiado que es fácil de entender en función de su situación específica).
Dado lo anterior, simplemente subclase UITableViewCell y anular setHighlighted:animated:
sin llamar super
's aplicación. Por lo tanto, todos los esfuerzos para activar highlighted
se suprimirán y el resaltado se realizará solo al tocar y no al tocar hacia abajo, que es exactamente lo que se espera al desactivar 'Mostrar selección al tocar'.
- (void)setHighlighted:(BOOL)highlighted animated:(BOOL)animated
{
// hack to get the effect of unchecking "Show Selection on Touch" option of UITableView in IB which has no effect
}
En retoque, la célula es selected
pero no es animated
. Si quieres la animación, descubrí que llamar a un método delegado como se muestra a continuación anima la selección.
- (NSIndexPath *)tableView:(UITableView *)tableView willSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
[_itemsTable selectRowAtIndexPath:indexPath animated:YES scrollPosition:UITableViewScrollPositionNone];
return indexPath;
}
- 1. Deshabilitar rebotes verticales de UITableView al desplazarse
- 2. Ocultar una vista y mostrar otra al tocar un botón
- 3. UITableView didSelectRowAtIndexPath agregar marca de verificación adicional al tocar
- 4. Problema al mostrar/ocultar divs
- 5. ¿Cómo mostrar ventana emergente al tocar superposición en android?
- 6. UITextField se bloquea al tocar
- 7. Problema al personalizar el estilo de selección de celdas en UITableView en iPhone
- 8. Imagen de arrastre al tocar
- 9. cómo ocultar la selección en UITableview?
- 10. UITableViewCells no anula la selección al regresar de un segue
- 11. ¿Cómo mostrar el teclado sin tocar UISearchbar?
- 12. UITableView, UIWebViews y ScrollsToTop Propiedad = Problema
- 13. UITableView Selección múltiple
- 14. Highcharts: problema con valores negativos al mostrar varios ejes
- 15. Problema al mostrar algunos archivos JPG en Delphi
- 16. Prevenir popToRootViewController automático al tocar dos veces en UITabBarController
- 17. Deshabilitar mensajes al cargar un paquete
- 18. ¿Cómo mostrar un NSSet en una UITableView?
- 19. Ocultar/Mostrar Barra de navegación y barra de herramientas al tocar
- 20. iPhone: ¿Es posible ocultar el teclado al tocar UITextField?
- 21. Deshabilitar la selección de una sola UITableViewCell
- 22. Deshabilitar animación al mover CALayers
- 23. Problema al utilizar AddIPAddress al suplantar a un usuario administrador
- 24. Android ListView Selección Problema
- 25. error al mostrar tostadas
- 26. UITableViewController - deshabilitar selección
- 27. Problema al utilizar ImageIO.read
- 28. Passenger Standalone no se reiniciará al tocar restart.txt
- 29. Problema al entender CGPathAddArc
- 30. Problema al usar ODP.Net