6
Je veux changer la taille de la cellule sélectionnée. Mais, ils décalent la position de la cellule tactile.Lorsque vous sélectionnez Cell, UITableViewCell pour changer la taille de la cellule
- (void)tableView:(UITableView *)aTableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
UITableViewCell *currentCell = [aTableView cellForRowAtIndexPath:indexPath];
CGContextRef context = UIGraphicsGetCurrentContext();
[UIView beginAnimations:nil context:context];
[UIView setAnimationDuration:0.5];
[UIView setAnimationDelegate:currentCell];
[UIView setAnimationDidStopSelector:@selector(endAnimation)];
float extendedSize = currentCell.frame.size.height;
currentCell.frame = CGRectMake(currentCell.frame.origin.x, currentCell.frame.origin.y, currentCell.frame.size.width, currentCell.frame.size.height + extendedSize);
UITableViewCell *afterCell;
for (int i=indexPath.row+1; i<=[aTableView numberOfRowsInSection:indexPath.section]; i++) {
afterCell = [aTableView cellForRowAtIndexPath:[NSIndexPath indexPathForRow:i inSection:indexPath.section]];
afterCell.frame = CGRectMake(afterCell.frame.origin.x, (afterCell.frame.origin.y + extendedSize), afterCell.frame.size.width, afterCell.frame.size.height);
}
[UIView commitAnimations];
}
Merci.
Ce succès. L'animation fonctionne correctement. Merci. – tochi
De rien. –
if ([indexPath isEqual: [tableView indexPathForSelectedRow]]) – andrei200287