¿Cómo hacer una celda de vista de mesa ampliable?
-
15-11-2019 - |
Pregunta
Me gustaría una celda de vista de la mesa que cuando toque, crece en altura para revelar un texto de descripción.Cuando vuelva a tocarlo de nuevo, vuelve a la versión menos alta.¿Es esto posible, y si es así, cómo lo lograría?Gracias de antemano
Solución
Use
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
--
In
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
when the user taps on a row, set the new row height in an array somewhere, then call tableview reload to redraw. It will call cellForRowAtIndexPath and since you know which cell has a large height, you return the larger cell for that row, and heightForRowAtIndexPath will ensure it is displayed correctly.
Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow