Hey ragazzi. Ho un problema con l'animazione di eliminazioni e inserimenti su un UITableView. Il fatto è, che ho diversi volumi di musica, alcuni 44,0 circa 135,0 ora. ho uitableviewstylegrouped con diverse sezioni. la prima riga di ogni sezione è una riga di raggruppamento. al clic rimuovo tutte le righe di questa sezione tranne la riga di raggruppamento. ma quell'animazione sembra strana quando si anima (UITableViewRowAnimationTop) la cella di altezza di 135px. Ho provato a impostare self.tableview.cellheight a 135 e ho commentato la tabellaView: cellHeightForIndexPath-Method. E l'animazione funziona bene. Oppure ho impostato tutte le celle a 135 in tableView: cellHeightForIndexPath-Method.Problema con RowAnimation
Sembra che il processo di animazione controlli l'altezza della prima riga nelle sezioni e tenga quell'altezza della cella per tutte le celle successive da animare.
Qualcuno un'idea?
- (void) showhideGroup:(int)group
{
NSMutableArray *indexPaths = [[NSMutableArray alloc] init];
MCGroup *handleGroup = [groups objectAtIndex:group];
NSMutableArray *groupRows = [visibleGroupData objectForKey:handleGroup.title];
[self.tableView beginUpdates];
if (!handleGroup.hidden) {
int row = 0;
for(MobileFieldMapping *field in groupRows)
{
if (![field.datatype matchesInsensitive:GROUPING_CELL])
{
NSIndexPath *path = [NSIndexPath indexPathForRow:row inSection:group];
[indexPaths addObject:path];
}
row++;
}
row = 0;
for(NSIndexPath *index in indexPaths)
{
[groupRows removeObjectAtIndex:index.row-row];
row++;
}
[self.tableView deleteRowsAtIndexPaths:indexPaths withRowAnimation:UITableViewRowAnimationTop];
handleGroup.hidden=YES;
}
else
{
NSMutableArray *allGroupRows = [groupData objectForKey:handleGroup.title];
int row = 0;
for (MobileFieldMapping *field in allGroupRows)
{
if (![groupRows containsObject:field])
{
NSIndexPath *path = [NSIndexPath indexPathForRow:row inSection:group];
[indexPaths addObject:path];
[groupRows insertObject:field atIndex:row];
}
row++;
}
[self.tableView insertRowsAtIndexPaths:indexPaths withRowAnimation:UITableViewRowAnimationTop];
handleGroup.hidden=NO;
}
[self.tableView endUpdates];
[indexPaths release];
}
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{
UITableViewCell *cell = [self tableView:tableView cellForRowAtIndexPath:indexPath];
if ([cell isKindOfClass:[FormCell class]])
{
return [(FormCell*)cell height];
}
return 44.0;
}
si dovrebbe postare la tabella visualizzare il codice sorgente delegato. – karim
ok nessuno ha un'idea ... sembra così – kaelum
Ho avuto questo funzionamento, quindi penso che sia un bug nel codice. Devi pubblicare il codice FULL o (meglio) fare un esempio più piccolo del problema. Inoltre, devi essere più specifico nel descrivere esattamente come "sembra strano" - nessuno può aiutarti con tale vaghezza. – Adam