ios - Expandir a célula de visualização de tabela como o aplicativo do Twitter
Eu quero ter o mesmo comportamento do aplicativo do Twitter ao selecionar um tweet: expandindo a linha e adicionando conteúdo suplementar.
Portanto, isso não é apenas um redimensionamento básico de linha. Eu acho que eu preciso de duas células personalizadas diferentes, então eu fiz algo assim:
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
if ([indexPath compare:self.selectedIndexPath] != NSOrderedSame) {
FirstCell *cell = [tableView dequeueReusableCellWithIdentifier:@"FirstCell"];
if (!cell) {
cell = [[FirstCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:@"FirstCell"];
}
cell.firstnameLabel.text = [[self.items objectAtIndex:indexPath.row] objectForKey:@"firstname"];
return cell;
}
else {
SecondCell *cell = [tableView dequeueReusableCellWithIdentifier:@"SecondCell"];
if (!cell) {
cell = [[SecondCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:@"SecondCell"];
}
cell.firstnameLabel.text = [[self.items objectAtIndex:indexPath.row] objectForKey:@"firstname"];
cell.lastnameLabel.text = [[self.items objectAtIndex:indexPath.row] objectForKey:@"lastname"];
return cell;
}
}
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath {
if ([indexPath compare:self.selectedIndexPath] == NSOrderedSame) {
return 80.0;
} else {
return 44.0;
}
}
#pragma mark - Table view delegate
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
self.selectedIndexPath = indexPath;
[tableView reloadData];
}
Meu problema aqui é que eu quero manter uma animação fluida como o aplicativo do Twitter, que não é o meu caso por causa de[tableView reloadData]
(que é obrigatório eu acho que desde que eu tenho 2 células personalizadas diferentes).
Então, alguém sabe uma solução para o meu necessário ou talvez alguém sabe como o aplicativo do Twitter está lidando com esse material de animação?